vendredi 1 juin 2018

How to show error message with dynamic value in laravel array validation

I am using laravel 5.4 . I am validating array in laravel. But is is showing error message by default. I want to show my own message for failed validation. Here is my array input field .

<input readonly type="text" id="users-id" name="student_id[]" placeholder="" value="" class="form-control input-border" required>

This is how I am validating this array in the controller.

'student_id.*'=> 'required|exists:studentinfo,batch_id|distinct|unique:student_projects,student_batchid',

But when any validation failed it shows me error like this.

Given student_id.1 is not exists.
Given student_id.2 is not exists.

I want to show input data instead of student_id.1, student_id.2... Like I have inputted 111-111 in my first input field then I want to show 111-111 is not exists
Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire