Skip to content

Instantly share code, notes, and snippets.

@ceceprawiro
Last active June 23, 2016 16:27
Show Gist options
  • Save ceceprawiro/7bb6a443fd4a3042f0952b8fd103ff98 to your computer and use it in GitHub Desktop.
Save ceceprawiro/7bb6a443fd4a3042f0952b8fd103ff98 to your computer and use it in GitHub Desktop.
Laravel Form Validation combination of first and last name must be Unique
public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'first_name' => 'required|max:100',
'last_name' => 'required|unique:user,last_name,NULL,id,first_name,'.$request->first_name.'|max:100',
]);
....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment