laravel:form-requests

Move Laravel validation and authorization into dedicated Form Request classes.

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/Patkik/Multi-tenant-SaaS-Catering-V2 --skill laravel-form-requests-patkik
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel:form-requests
Source: https://github.com/Patkik/Multi-tenant-SaaS-Catering-V2/tree/main/.agents/skills/form-requests-and-validation
Command: npx skills add https://github.com/Patkik/Multi-tenant-SaaS-Catering-V2 --skill laravel-form-requests-patkik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Promotes moving validation and authorization to dedicated Form Request classes, keeping controllers focused on orchestration and domain intents.

Core Features & Use Cases

  • Centralize authorize() and rules in Form Requests to gate access and validate input.
  • Use rule objects and custom messages to keep controllers slim and maintainable.
  • Validate nested data (e.g., items.*.sku, addresses.home.city) and reuse common rules across requests.
  • Test the end-to-end flow by asserting validation errors and success responses in feature tests.

Quick Start

Create a dedicated Form Request class for your target action and type-hint it in the controller method.

Frequently Asked Questions about laravel:form-requests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I keep Laravel controllers slim when handling complex validation?

To keep Laravel controllers slim, move validation and authorization logic into dedicated Form Request classes. This centralizes rules and messages, allowing controllers to focus solely on orchestration and domain intents.

Can I validate nested data structures using Laravel form requests?

Yes, Laravel form requests support validating nested data structures using dot notation. You can define rules for nested arrays and objects like items.*.sku or addresses.home.city directly within the rules() method of your form request class.

What is the best way to authorize and validate user input separately in Laravel?

The best way to authorize and validate user input separately in Laravel is using Form Requests. By defining an authorize() method for access control and a rules() method for input validation, you cleanly separate these concerns.

How do I retrieve only the validated data from a Laravel form request?

To retrieve only the validated data from a Laravel form request, use the $request->validated() method. This returns an array of exclusively the data that passed your defined validation rules, ensuring safe input for your controllers.

Does Laravel form request validation support custom error messages and attributes?

Yes, Laravel form request validation supports custom error messages and attributes. You can define a messages() method and an attributes() method within your Form Request class to override default validation messages and field names.

Why should I use Laravel form requests instead of validating directly in controllers?

You should use Laravel form requests instead of validating directly in controllers to centralize validation rules and authorization logic. This approach improves maintainability, allows rule reuse across multiple requests, and keeps controllers focused on business logic.