Mel*_*vin 2 php validation schema laravel laravel-4
我有这个架构:
Schema::create('members', function(Blueprint $table)
{
$table->increments('id');
$table->string('lname');
$table->string('fname');
$table->integer('mname');
$table->unique(array('lname', 'fname'));
});
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何验证这些独特的字段?
我试过这个,但我知道这是错的......
public static $rules = array(
'lname' => 'unique:members',
'fname' => 'unique:members'
);
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.. :)
你应该使用这个包https://github.com/felixkiss/uniquewith-validator
像这样用它:
$rules = array(
'<field1>' => 'unique_with:<table>,<field2>[,<field3>,...,<ignore_rowid>]',
);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5711 次 |
最近记录: |