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

这里的技术是共享的

You are here

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

普通分类: