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
Dennis Koch
Dennis Koch2y ago
Either use a Data Aware Rule (see Laravel Validation docs) or maybe some construct with ->rule(fn ($get) =>)
ByteXR
ByteXROP2y ago
Brilliant! thanks!
Dennis Koch
Dennis Koch2y ago
You can also use afterValidation() and write a custom Validator
Want results from more Discord servers?
Add your server