I have a form. Type field is a drop-down and has only two possible values. Second field is bcode.
E.g.
if table has data like-
ID TYPE BCODE
1 1 2
2 1 3
3 2 2
4 1 4
5 2 2
Now I am making a popup form to insert record in this table. So if type is entered 1 and bcode is entered 2,3 or 4 its already in table so it will be invalid but any other numeric value will be valid. Similarly if type is entered 2 then bcode can't be anything other than 2,3 or 4. All other values will be invalid.
I read the Laravel docs here-
https://laravel.com/docs/6.x/validation#custom-validation-rules
But did not find anything.
Anyone tried something similar?
php artisan help make:rule
will help you understand how to use the built in generator for this. That will put a new rule class in the app/Rules folder where you can implement what you need.