Laravel 4: making a combination of values/columns unique

后端 未结 5 1964
灰色年华
灰色年华 2020-12-14 01:07

I\'m importing a bunch of csv entries in my database with Laravel 4.

I can\'t really point at one column that has to be unique, it\'s a combination of 5 columns that

5条回答
  •  情歌与酒
    2020-12-14 01:24

    Use Schema Builder's unique() method to define your data model, as Antonio mentioned.

    Additionally, if you want to use validation on your model, consider my custom Validator rule for multiple UNIQUE indexes: https://github.com/felixkiss/uniquewith-validator

提交回复
热议问题