I have an input value that can be either an actual ID existing in the database or a 0 indicating special case.
In any case, if this value is sent not-empty, I need it to be validated with something like
Validator::make($data, [
'item_id.*' => 'required|in:0[OR]exists:items_table,id',
]);
The problem is I did not manage to find any documentation on how to do this "[OR]
". Almost everything I managed to find is related to testing against other key or checking just against an explicit array without the exists "or".
NOTE: This is not case of required_if/unless because I need to check against the currently tested value, not against other key.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire