← ClaudeAtlas

labrodev-querylisted

Use when creating, reviewing, or extending read-side query classes in a Labrodev Laravel project: Core Domain Query classes (e.g. BookingQuery) and Layer IndexQuery classes (e.g. BookingIndexQuery), or when deciding where any data-fetching code (listing, filtering, sorting, existence checks) belongs.
labrodev/laravel-playbook · ★ 0 · Data & Documents · score 73
Install: claude install-skill labrodev/laravel-playbook
# Read side: Core Queries and Layer IndexQueries Part of the Labrodev playbook. **The law for this component lives in the always-on `labrodev-query` guideline** (musts, must-nots); the per-file checklist is `rules/queries.md`. This skill holds the craft: anatomy, canonical templates, and edge cases. Two read-side class families exist, with different homes and jobs: | Class | Location | Job | |---|---|---| | `{Model}Query` | `Core/Domain/{Domain}/Queries/` | Single source of truth for querying that model. Composable `Builder` methods for business reads. | | `{Model}IndexQuery` | `App/Layer/{Layer}/{Domain}/IndexQueries/` | Spatie QueryBuilder subclass for one interface's listing needs: user-driven filters, sorts, pagination, table columns. | ## Template: Core Query class Naming pattern: `{Model}Query` in `Core\Domain\{Domain}\Queries`. Worked example — Booking domain: ```php <?php declare(strict_types=1); namespace Core\Domain\Booking\Queries; use Core\Domain\Booking\Models\Booking; use Core\Domain\Customer\Models\Customer; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Carbon; final class BookingQuery { /** * @return Builder<Booking> */ public function all(): Builder { return Booking::query(); } /** * @return Builder<Booking> */ public function byId(int $id): Builder { return Booking::query()->where('id', '=', $id); } /** * @return Builder<Booking> */ public fun