jeudi 3 septembre 2020

Validate field with name stored in multidimensional array in laravel

I have array type field like

foreach ($row as $data) {
    

    
}

Now in my controller i want to validate these field (i.e. required or not) based on condition.

Controller :

  foreach($req)...
     if(somevalue)
     {
         $rules[$fieldname['name']] = 'required';
     }
    }

Here the issue is i have common name for the field, so i will i specify the name that is to be validated in the rules array.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3hVJJsO
via IFTTT

Aucun commentaire:

Enregistrer un commentaire