Update dependencies

Composer: Laravel 13.43, Octane 2.25, Fortify 1.43 and Pest 5.3.7,
with the packages they bring (70 in all). This fixes the advisories
in Laravel and the Symfony components. npm: Vite 8.3.8 with Rolldown
1.2.19, Playwright 1.65.1 and chokidar 6. The asset build, CI and the
dev container use Node.js 26. The dev image also has git for
Composer. Both audits are clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 06:45:31 +01:00
co-authored by Claude Opus 5.5
parent cf73052e0e
commit 5679e62c78
41 changed files with 1432 additions and 1226 deletions
@@ -1,6 +1,6 @@
# Validation and Forms Best Practices
# Validation and forms best practices
## Extract Validation When It Improves the Boundary
## Extract validation when it improves the boundary
Use a form request when validation or authorization is substantial, reused, or clearer outside the controller. Inline `$request->validate()` remains appropriate for a small, endpoint-specific rule set.
@@ -13,11 +13,11 @@ public function store(StorePostRequest $request): RedirectResponse
}
```
A form request's `authorize()` method can enforce access to the operation. Validation establishes the shape and values of input; it does not itself authorize the user.
A form request's `authorize()` method can enforce access to the operation. Validation checks the shape and values of the input. Validation alone does not authorize the user.
## Prefer Readable Rule Syntax
## Prefer readable rule syntax
Array syntax composes cleanly with rule objects and avoids delimiter issues. Prefer it in new code when it improves readability, while following a consistent local style.
Array syntax combines with rule objects and avoids delimiter problems. Prefer array syntax in new code when it improves readability, and keep the local style consistent.
```php
'email' => ['required', 'email', Rule::unique('users')],
@@ -29,9 +29,9 @@ String syntax remains valid for simple rules:
'email' => 'required|email|unique:users',
```
## Use Only Intended Validated Data
## Use only the validated data you intend
Use `validated()` or `safe()` instead of `$request->all()` when passing request data onward. Then select the fields intended for the operation when the validation rules also cover control fields or nested data.
Use `validated()` or `safe()` instead of `$request->all()` when passing request data onward. When the validation rules also cover control fields or nested data, select only the fields intended for the operation.
Unsafe:
@@ -45,9 +45,9 @@ Preferred:
$post = Post::create($request->safe()->only(['title', 'body']));
```
Validated data is not automatically safe for mass assignment. Keep model `$fillable` or `$guarded` rules aligned with the operation, and never add a sensitive attribute to validation merely to make mass assignment convenient.
Validated data is not automatically safe for mass assignment. Keep model `$fillable` or `$guarded` rules aligned with the operation, and never add a sensitive attribute to validation only to make mass assignment convenient.
## Express Conditional Rules Clearly
## Express conditional rules clearly
Use conditional rules such as `Rule::when()`, `required_if`, or `exclude_unless` when they make the condition explicit. Choose the simplest form that remains easy to test.
@@ -63,9 +63,9 @@ Use conditional rules such as `Rule::when()`, `required_if`, or `exclude_unless`
],
```
## Add Cross-Field Validation After Base Rules
## Add cross-field validation after base rules
Use a form request's `after()` method for validation that depends on multiple fields or application state. Avoid expensive queries when prerequisite fields have already failed validation.
Use a form request's `after()` method for validation that depends on multiple fields or application state. Skip expensive queries when prerequisite fields already failed validation.
```php
public function after(): array