mardi 9 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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire