Validation (Laravel)

Rules that check incoming data before it is used; on failure Laravel sends the visitor back with error messages.

Also called: validate, Form Request, 422

Type
Term
Source
General
Language
PHP

Example

Validation sent the visitor back with "The email field is required."

In code

$data = $request->validate([
    'name'    => 'required|string|max:120',
    'email'   => 'required|email',
    'guests'  => 'integer|min:1|max:8',
    'website' => 'nullable|url',
]);

A Form Request class (php artisan make:request) keeps the rules out of the controller.

Related terms

Added 2026-11-30 · Last reviewed 2026-11-30