MWZ

MINDWAREZONE

intermediateLaravel

What is a Form Request?

Answer

Clear, interview-ready explanation

A Form Request is a custom request class that encapsulates validation and authorization for a specific HTTP action. It extends Laravel’s request handling and is usually generated with php artisan make:request StorePostRequest.

Its rules method defines validation rules and its authorize method decides whether the current user may perform the action. Type-hinting the Form Request in a controller causes Laravel to authorize and validate it before the controller method runs, keeping controllers focused on the successful use case.