samedi 18 avril 2020

How to check if one Rule is applied in Laravel?

I have to check if input is IP, URL or Domain. I created a new Rule named Domain to validate Domain values.

The question is:

How to check if the input passing one Rule of the three? if one Rule is valid then the validation must success.

request()->validate(['param' => ['required|ip'])
request()->validate(['param' => ['required|url'])
request()->validate(['param' => ['required|new Doamin'])

Is there any thing like:

request()->validate(['param' => ['required|ip || url || new Doamin']) ?

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire