lundi 27 avril 2020

Laravel validators: prevent submit 2 parameters together

How to prevent presents of 2 parameters that existed in required_without_all validator, ex:

    return [
        'user' => 'required_without_all:customer,public',
        'customer' => 'required_without_all:user,public',
        'public' => 'required_without_all:user,customer',

    ];

How to prevent user from submit 2 keys from above together, ex:

http://127.0.0.1:8000/app/groups-statistics?user=10&customer=10

These are allowed requests:

http://127.0.0.1:8000/app/groups-statistics?user=10
http://127.0.0.1:8000/app/groups-statistics?customer=10
http://127.0.0.1:8000/app/groups-statistics?public=true

Disallowed:

http://127.0.0.1:8000/app/groups-statistics?pubilc=true&customer=10
http://127.0.0.1:8000/app/groups-statistics?user=10&customer=10
http://127.0.0.1:8000/app/groups-statistics?public=10&customer=10


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3aIs57e
via IFTTT

Aucun commentaire:

Enregistrer un commentaire