Passionate full-stack developer with an eye for usability and carefully crafted interfaces. Laravel provides different approaches to validate your application’s incoming data. My favorite method to validate input data in controllers is to create Form Requests: custom request classes that contain authorization and validation logic.
Creating a new form request is straightforward because we can leverage an Artisan command: And here’s the code: As you can see we are applying a custom validation rule on the synonyms field.
We can leverage this method to provide a completely custom error message, modeled around the validation failures.