I have created the form and created multiple fields.
<input name="members[]" type="text" class="form-control">
<input name="members[]" type="text" class="form-control">
<input name="members[]" type="text" class="form-control">
set the validation from the Form Request for the input fields
public function rules()
{
return [
'password' => 'required|max:30',
'members.*' => 'required|max:12',
];
}
How can we check the members' field value exists in the database using the validation? For password using like this
'password' => ['required', function ($attribute, $value, $fail) {
if (!\Hash::check($value, $this->user()->password)) {
$fail('Old Password did not match to our records.');
}
}],
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire