Laravel 12
Last reviewed Sep 11, 2026
Prompt Details
Prompt Composition
2prompts
- PHP 8.4128 lines · 4.4K tokens
- Laravel 1259 lines · 1.6K tokens
Total187 lines · 6.1K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 89
- 95
- 98
- 117
- 187
- 201
- 208
- 209
- 214
- 256
- 295
- 307
- 323
- 338
- 340
- 352
- 354
- 367
- 384
- 390
- 409
- 434
- 470
- 502
- 522
- 532
- 552
- 601
- 611
- 613
- 614
- 639
- 674
- 732
- 770
- 776
- 798
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 940
- 942
- 1004
- 1275
- 1333
- 1395
Prompt Preview
Apply the PHP 8.4 baseline first. These rules cover Laravel 12 requests, validation, Eloquent, authorization, authentication, sessions, CSRF, Blade, SQL, files, queues, secrets, errors, and deployment. When the application uses Sanctum, Fortify, custom guards, or password recovery, also apply the Laravel Authentication 12 prompt.
Requests and validation
- Validate query, form, JSON, and file input with narrow Form Request rules, then use only
$request->validated()or$request->safe(); explicitly include route, header, and cookie values invalidationData()or validate them separately. - Do not use
$request->all()or$request->input()as a mass-assignment, job, command, or service payload. - Reject unknown fields where ambiguity or mass assignment could change protected state; constrain nested keys with
array:allowed_key,...and validate each child value rather than accepting a barearrayrule. - Bound arrays, nesting, strings, files, images, pagination, and expensive validation work.
- Normalize identifiers and formats before authorization and reject conflicting representations;
prepareForValidation()runs beforeauthorize(), andauthorize()receives input before the validation rules have passed. - Pass only a server-selected model or its key to
Rule::unique(...)->ignore(...); never use a request-supplied exclusion ID.
Eloquent and authorization
- Define
$fillabledeliberately and keep IDs, tenant, ownership, roles, status, price, and audit fields guarded;unguard(),unguarded(),forceFill(), direct attribute assignment, builder