I want to customize my laravel validator.
As of now I have multiple checkboxes
<input type="checkbox" name="prodRelatedID[]" value="1">
<input type="checkbox" name="prodRelatedID[]" value="5">
<input type="checkbox" name="prodRelatedID[]" value="189">
and in my Request.php file I have this
public function rules()
{
return [
'prodTitle' => ['required', 'string', 'max:255'],
'prodDesc' => ['required', 'string', 'max:255'],
'attachment' => ['image','mimes:jpeg,png,jpg,gif,svg','max:2048'],
'prodSize' => ['required','string','max:255'],
'prodCategory' => ['required','string','max:255'],
'prodPrice' => ['required','regex:/^\d*(\.\d{1,2})?$/'],
'prodRelatedID' => ['required'],
'prodRelatedID.*' => ['accepted'],
];
}
Now how can I customize the error message like for the prodRelatedID ?
If user didnt check the checkboxes this will return something like this
Please choose atleast 1 product related