A
A
Alexey Verkhovtsev2018-04-23 19:42:29
Laravel
Alexey Verkhovtsev, 2018-04-23 19:42:29

Laravel array form field validation, how to process?

Hello! There is a field, there can be many of them, they are added to js

<input class="form-control" type="text" name="plan_name[]">

How to check if there is a string in this field? I can check for the required|array array, but I need to check the elements of the array

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yan-s, 2018-04-23
@seftomsk

Use the "plan_name.*" notation in the validator - it will check each element of the array according to the specified rules.
https://laravel.ru/docs/v5/validation#%D0%BF%D1%80...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question