jeudi 30 mars 2017

laravel request - combine rules with or operator

I was wondering if in laravel 5.4 you can combine multiple request rules with OR operator instead of the AND.

For example: if ou want to write a request rule for a number and you want that number to be required and alpha num you will do something like that:

'number' => 'required|alpha_num',

But let's say that you want the number field to have or alpha_num of alpha_dash or CustomValidator. something like that

'number' => 'required|(alpha_num or alpha_dot or customValidator)',

for the second rule (with the alpha..) if any matche is found the request is true. It's more like an OR operator than a AND with the |. I want at least one match Thank you for your help



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oDtnJ2
via IFTTT

Aucun commentaire:

Enregistrer un commentaire