$validator = Validator::make($post,
array(
'f_name' => 'required|min:7',
'l_name' => 'required|min:7',
'login' => 'required|unique:users|min:7'
)
);
有什么可以检查记录是否存在吗?
类似的东西:
'login' => 'required|min:|exists:users'
答案 0 :(得分:2)
是的,语法为exists:table,column
。例如:
$validator = Validator::make($post, array(
'f_name' => 'required|min:7',
'l_name' => 'required|min:7',
'login' => 'required|min:7|exists:users,login'
));