← ClaudeAtlas

filament-architecturelisted

Keep business logic out of Filament (v4/v5) and in framework-free UseCase classes in Laravel apps. Use this whenever the user adds, changes, refactors or reviews anything in a Filament resource, page, table/header/bulk action, toggle/select column, relation manager, importer or Create/Edit hook that writes data or has side effects — status changes, money or stock maths, limits, emails, notifications, external APIs — even for one small action, and even if they never mention use cases or architecture. Examples - "add a Mark as paid action to InvoicesTable", "this EditInvoice page is huge and untestable", "where should this logic go", "review my Filament code", "set up clean architecture / DDD layers with Pest arch tests". Not for display-only Filament work (theming, column formatting, read-only tables, a plain generated CRUD resource) or for non-Filament code.
zahansafallwa1511/filament-architecture · ★ 0 · Code & Development · score 72
Install: claude install-skill zahansafallwa1511/filament-architecture
# Filament + UseCases Filament is a delivery mechanism, exactly like a controller. Its job is to render, collect input, call **one use case**, and show the result. The business rules — what is allowed, what changes, what happens next — live in **Application use cases** and the **Domain**, which know nothing about Laravel, Filament, HTTP or the database. That lets the rules be unit-tested in milliseconds and reused unchanged from an API endpoint, an artisan command or a queued job. A quick test for "is this business logic?": *if the same operation were triggered from an API endpoint or a CLI command, would this code have to be copied there?* If yes, it belongs in a use case, not in Filament. ## Layers (layered layout) | Layer | Path | Contains | May depend on | |---|---|---|---| | Domain | `app/Domain/<Context>/` | enums with rules, value objects, domain exceptions, repository/gateway **interfaces**; entities in strict mode | PHP only | | Application | `app/Application/<Context>/UseCases/` | one class per user intention + its Input/Result DTOs | Domain (+ models in pragmatic mode) | | Infrastructure | `app/Infrastructure/<Context>/` | Eloquent repositories, mailers, HTTP clients, clock, transactions — implementations of Domain interfaces | anything | | Filament | `app/Filament/` | resources, pages, actions, schemas, tables | Application, Domain, Models | | Models | `app/Models/` | Eloquent models (persistence + read model) | Laravel | **Reads vs writes.** Filament tables,