Unique validation is not working in Laravel
$validator = Validator::make(request()->all(),
[
'firstname'=> 'required',
'lastname'=>'required',
'email'=>"required|unique:users,email",
'password'=>'required',
'phone'=>"required|unique:users,phone"
]);
if ($validator->fails()){
return Response::json(
array(
'code' => 400,
'message' => $validator->messages()->toArray()
), 400);
}
not working for non unique values
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire