一键导入
laravel-form-requests
Move validation and authorization into Form Requests; use rule objects, custom messages, and nested data handling to keep controllers slim
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Move validation and authorization into Form Requests; use rule objects, custom messages, and nested data handling to keep controllers slim
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Build AI features with the first-party Laravel AI SDK (Laravel 13+); agents, embeddings, images, audio, and tool calling with provider-agnostic APIs
Use API Resources with pagination and conditional fields; keep response shapes stable and cache-friendly
Compose UIs with Blade components, slots, and layouts; keep templates pure and testable
Request effective code reviews—specify focus areas, provide context, ask for architectural feedback, reference Laravel conventions
Practical daily checklist for Laravel projects; bring services up, run migrations, queues, quality gates, and tests
Create effective debugging prompts—include error messages, stack traces, expected vs actual behavior, logs, and attempted solutions
| name | laravel:form-requests |
| description | Move validation and authorization into Form Requests; use rule objects, custom messages, and nested data handling to keep controllers slim |
Promote validation and authorization to dedicated Form Request classes. Keep controllers focused on orchestration and domain intents.
# Create a request
sail artisan make:request UpdateProfileRequest # or: php artisan make:request UpdateProfileRequest
# Use in controller method signature
public function update(UpdateProfileRequest $request) {
$data = $request->validated();
// ...
}
authorize() to gate access; prefer Policies for complex checksRule::unique('users', 'email')->ignore($user->id)items.*.sku, addresses.home.citynullable + specific rules instead of sometimes for optional fieldsattributes() and messages()Rule classes or traits$request->safe()->only([...]) when partial updates are intended// Strict mode: reject undeclared input fields
use Illuminate\Foundation\Http\Attributes\FailOnUnknownFields;
#[FailOnUnknownFields]
class StoreUserRequest extends FormRequest { /* ... */ }
// Or globally (AppServiceProvider) — strict in non-production
FormRequest::failOnUnknownFields(! app()->isProduction());
// Validate arbitrary JSON payloads against a schema
use Illuminate\JsonSchema\Types\Type;
$request->validate([
'data' => [Rule::jsonSchema(Type::object([
'name' => Type::string()->required(),
'age' => Type::integer()->min(0),
]))],
]);
// Typed enum handling for optional input
$request->whenFilledEnum('status', Status::class, fn (Status $status) => /* ... */);