I am trying to adapt the default registration form in Laravel to my database custom users table; I have a checkbox that isn't returning values, and even though it's selected it doesn't return a value. The validator alerts me that the checkbox field is required after submitting even though I selected it.
This is the checkbox:
<!--checkbox-->
<div class="form-group row">
<label for="usertype" class="col-md-4 col-form-label text-md-right">Type Utilisateur</label>
<div class="col-md-6">
<input type="checkbox" name="check[]" value="normal"/> Normal
<input type="checkbox" name="check[]" value="admin"/> Admin
<input type="checkbox" name="check[]" value="super"/> Super
@if ($errors->has('usertype'))
<span class="help-block">
<strong>{{ $errors->first('usertype') }}</strong>
</span>
@endif
</div>
</div>
Edit: Validator
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:6', 'confirmed'],
'telephone' => ['required', 'numeric'],
'usertype' => ['required', 'string'],
]);
}
Note: I removed usertype from Validation but the registration wouldn't go on the register page would refresh and no error appears or any alerts