欢迎各位兄弟 发布技术文章

这里的技术是共享的

laravel unique two columns 两个字段唯一

Schema::create('devplans', function ($table) {
// ...
$table->unique(array('level_id', 'building_id'));
});

来自

http://laravel.io/forum/10-12-2014-two-field-in-combination-should-be-unique-in-database


You can combine:

$table->unique( array('email','name') );

And pretty much everything in Laravel will accept arrays to do whatever you need to with 'more than one'.

来自 http://stackoverflow.com/questions/16990723/laravel-4-making-a-combination-of-values-columns-unique

唯物品评历史

关注"唯物品评历史",跟着泪痕春雨先生,读懂历史,看彻人生

打开隐藏二维码