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 the 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.
This is the html of the checkbox
<input type="checkbox" name="checkbox" id="option" value="{{old('option')}}"><label for="option"><span></span> <p>Ik ga akkoord met de <a href="#">algemene voorwaarden</a></p></label>
I hope you guys can help me!