Forms and Validation for Laravels
Forms and validation in Laravel cover receiving user input and checking it before use. Form Request classes hold validation rules and authorisation for a request, failed checks redirect back with errors, and the config directory plus .env file keep environment specific settings out of code.
Stage: Foundations · Part of the Laravel roadmap · Last reviewed 19 November 2026
What to learn in Forms and Validation
- Create a Form Request class and move validation rules out of the controller
- Display validation errors and old input in a Blade form
- Protect forms with the CSRF token and method spoofing for PUT and DELETE
- Write custom validation rules for logic the built-in rules do not cover
- Read settings with config() and keep secrets in the .env file
Forms and Validation interview questions
Why use a Form Request instead of validating in the controller?
A Form Request keeps validation and authorisation rules in a dedicated class, so the controller stays short and the rules can be reused and tested. Laravel runs it before the controller method, and invalid input never reaches your logic.
What is the difference between env() and config() in Laravel?
env() reads from the .env file, while config() reads values from files in the config directory. Call env() only inside config files. Once configuration is cached for production, env() outside of config returns null, so the application should use config().
Where Forms and Validation fits in the Laravel roadmap
Forms and Validation belongs to the Foundations stage (beginner level), which takes about 20 hours. The Laravel way.
Other units in this stage
Back to the full Laravel roadmap