Laravel Validation Unique Email
'email' => 'unique:users,email_address,'.$user->id
Dizzy Dove
'email' => 'unique:users,email_address,'.$user->id
'email' => 'required|email|unique:users,email',
//@sujay
/**
* Store a new blog post.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$validatedData = $request->validate([
'title' => 'required|unique:posts|max:255',
'body' => 'required',
]);
// The blog post is valid...
}
use Illuminate\Validation\Rule;
'name' => ['required', Rule::unique('items')->ignore($this->id)],
unique:table,column,except,idColumn
############## Example : ################
############### For Updating
//rules
'email' => 'unique:users,email_address,' . $userId,
############### For Creating
//rules
'email' => 'unique:users,email_address',
'user.email' => 'required|email|unique:users,email,'.$user->id,
//@sujay