mercredi 11 juillet 2018

Required_if with data type - Laravel

I want to validate name & status.

If status = 1 else it should skip validation of name. When I send status = 0 it says:

name must be a string

But it should skip validation of name as per conditional validation.

When I send status=1 then it works as intended.

'status' => 'required|numeric',
'name' => 'required_if:status,1|string'

What needs to be corrected here?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire