I am using the laravel register function to register a user. I added a checkbox where the user needs to accept the terms and conditions. I only want to user to register when the checkbox is checked. Can I use the 'required' validation in laravel? This is my validation function:
return Validator::make($data, [
'firstName' => 'required|max:255',
'lastName' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
'checkbox' =>'required',
]);
When I use the function like this, laravel gives the required error for the checkbox even if it is checked. I hope you guys can help me!
Aucun commentaire:
Enregistrer un commentaire