← ClaudeAtlas

labrodev-controllerlisted

Use when creating, reviewing, or wiring HTTP controllers or routes in a Labrodev Laravel project — invokable Inertia controllers (BookingIndexController, BookingStoreController), JsonControllers under a json/ prefix, API controllers, or route files (explicit routes, {model:uuid} binding, POST /remove).
labrodev/laravel-playbook · ★ 0 · Data & Documents · score 73
Install: claude install-skill labrodev/laravel-playbook
# Controllers and Routes Part of the Labrodev playbook. **The law for this component lives in the always-on `labrodev-controller` guideline** (musts, must-nots, route rules); the per-file checklist is `rules/controllers.md`. This skill holds the craft: controller anatomy, canonical templates, and edge cases. Controllers live in `App/Layer/<Layer>/{Domain}/Controllers` (Inertia/API) and `App/Layer/<Layer>/{Domain}/JsonControllers` (in-page JSON) — the `{Domain}` folder name mirrors `Core/Domain/{Domain}` exactly. A controller is a **thin dispatcher**: it receives HTTP input, delegates to Core, and returns a response. Nothing else — collecting page data beyond the primary subject is the ViewModel's job (→ labrodev-viewmodel-resource skill). ## The current user When an endpoint needs the authenticated user, it arrives as a parameter via Laravel's container attribute — never fetched in the body: ```php use App\Models\User; use Illuminate\Container\Attributes\CurrentUser; public function __invoke( #[CurrentUser] User $user, BookingData $bookingData, BookingCreate $bookingCreate, ): RedirectResponse { // ... } ``` `auth()->user()`, `request()->user()`, and `Auth::user()` in a controller body (with their `/** @var User $user */` docblock crutches) are the anti-pattern this replaces. ## Read controller (Inertia) Naming: `{Model}{Action}Controller` — here `Booking` + `Index` + `Controller`. ```php <?php declare(strict_types=1); namespace App\Layer\Dashboard