I have tried validating the user request like this:
$data = $request->validate([
'fname' => 'nullable',
'lname' => 'nullable',
'gender' => 'required',
'mobile' => 'required|unique:users,usr_name',
'ncode' => 'nullable',
'password' => 'required',
'password_confirmation' => 'required',
]);
That the mobile
filed value must be unique:users,usr_name
but I do need to check that it is unique at members
table as well (the mbr_mobile
column):
unique:members,mbr_mobile
So how to combine these two rules at once?
2
Answers
You can do it exact,y same way as for users table :
Just specifying the model name should work.
But you may specify the column name too.