mercredi 10 novembre 2021

Conditionally validate request fields in Laravel 5

My variable carType gets a string value.

If additionalFields variable is carType should be required when it is a truck or caravan. If carType is a truck, then additionalFields should be a array.

'carType' => 'string',
'additionalFields' => 'required_if:carType,truck,caravan',

How do i add an array validation based on condition?



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

Aucun commentaire:

Enregistrer un commentaire