mardi 31 mai 2016

Making unique field validation while updating

I am trying to validate for the unique record While editing but it always displays the field must be unique. basically i need to ignore the value of that id. id is the primary key.

$validator=Validator::make($request->all(),[
'name'=>'required',
'telephone'=>'required|unique:telephone',
'email'=>'unique:telephone',
'altemail'=>'unique:telephone',
'image'=>'image',

]);

if($validator->fails()){
return redirect('/telephone/addview')
    ->withErrors($validator);   
     }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire