Custom rule depended on other field
Is it possible to use
->rule()
on form input when it is depended on other field, for example if phone number validation is dependant on selected country.
Thank you for the help!3 Replies
Either use a Data Aware Rule (see Laravel Validation docs) or maybe some construct with
->rule(fn ($get) =>)
Brilliant! thanks!
You can also use
afterValidation()
and write a custom Validator