3 min readCalm pace · scan the outline anytime

Filament UI

Optional Filament admin resources live in UI — invoke Use Cases; never embed Domain policy in form hooks alone.

Filament UI

Filament is an optional Laravel admin delivery mechanism under {Module}/UI/Filament/. It is not Domain and not a shortcut around Use Cases.

Placement

Ordering/UI/Filament/
├── Resources/
│   └── Orders/
│       ├── OrderResource.php
│       └── Pages/
├── Actions/          # optional custom actions
└── …

Rules

AllowedForbidden
Filament Actions / pages call first-level *UseCaseBusiness policy only inside mutateFormDataBeforeCreate without a Use Case
Map form state → Application DTOInjecting peer *ModuleInterface into Resources
Present Domain results / exceptions as notificationsUsing Eloquent models from another module to decide eligibility
Standard CRUD that still goes through Use Cases when policy existsCross-module Eloquent joins for “convenient” admin tables

Action pattern (illustrative)

// UI/Filament — delivery only
Action::make('fulfill')
    ->requiresConfirmation()
    ->action(function (OrderModel $record) {
        ($this->markOrderFulfilled)(new MarkOrderFulfilledDTO(
            orderReference: $record->getReference(),
        ));
    });

Prefer resolving the Use Case via the container / constructor injection on the Page or Action class — same entry-point rules as Controllers.

Forms and tables

  • Validate shape in Filament (required, max length, types).
  • Encode policy in Domain / Use Cases.
  • List subheadings and empty states should use professional, usage-oriented English (operator-facing), not internal architecture jargon.

Error handling

Catch Domain exceptions in the UI layer and map them to Filament notifications. Do not swallow replaceability-breaking imports to “get a friendlier message” from a peer module’s Domain.

Wave note

Deeper Filament Builder / navigation recipes may grow here later; Core entry-point and ACL rules already apply today.

Core reference: Golden flow · Use cases & DTOs.

Modular Hexagonal Domain-Driven Design
Core 1.0.0-draft