Filament Architecture
Overview
The admin panel uses Filament v5 with two separate panels: Portal (main admin) and Education (teacher/student management). Each panel has its own middleware stack, theme, and resource set.
Panel Structure
| Panel | URL | Guard | Audience |
|---|---|---|---|
| Portal | /portal | portal | HR, finance, recruitment, contracts |
| Education | /education | education | Teachers, academic staff |
Folder Structure
app/Filament/
├── Clusters/ # Resource groups
│ ├── RecruitmentCluster/
│ ├── SystemSettings/
│ └── ...
├── Forms/
│ └── Components/ # Custom form components
│ ├── Inputs/ # Custom input fields
│ ├── Selects/ # Custom select fields
│ ├── Editors/ # Rich text editors
│ ├── Pickers/ # Date/Time pickers
│ ├── Media/ # File uploads
│ └── Containers/ # Layout containers
├── Schemas/
│ └── Components/ # Custom schema (infolist) components
│ ├── Cards/ # Info cards
│ ├── Stats/ # Statistics widgets
│ ├── Timeline/ # Activity timeline
│ └── Layout/ # Layout components
├── Pages/ # Custom pages (auth, dashboard)
├── Resources/ # Filament resources organized by domain
│ ├── Applicants/
│ ├── Vacancies/
│ └── ...
└── Widgets/ # Dashboard widgetsResource Structure
Each resource follows one of two patterns:
Simple resource (minimal — schema/table inline):
Resource.php # Schema + table defined directly in the classStandard resource (organized — separate files):
Resource.php
├── Schemas/ # Form/Infolist schemas
│ ├── ResourceForm.php
│ └── ResourceInfolist.php
├── Tables/ # Table configurations
│ └── ResourceTable.php
└── Pages/ # CRUD pages
├── ListResources.php
├── CreateResource.php
├── EditResource.php
└── ViewResource.phpCustom Components
Filament built-ins are used by default, but custom components are created when the built-in doesn't meet the design requirement.
Form Components (app/Filament/Forms/Components/)
| Category | Examples |
|---|---|
| Inputs | Custom text inputs with specific validation/formatting |
| Selects | Searchable selects with custom option rendering |
| Editors | Rich text editors with custom toolbars |
| Pickers | Date/time pickers with range selection |
| Media | File upload with preview, drag-and-drop |
| Containers | Layout wrappers, tabs, wizards |
Infolist Components (app/Filament/Schemas/Components/)
| Category | Examples |
|---|---|
| Cards | Info cards with icon, status, actions |
| Stats | Statistics display widgets |
| Timeline | Activity log timeline |
| Layout | Column layouts, sections |
Middleware Stack
Each panel has its own middleware stack in the Panel Provider:
PortalPanelProvider:
EncryptCookies → AddQueuedCookies → StartSession → AuthenticateSession
→ ShareErrorsFromSession → PreventRequestForgery → SubstituteBindings
→ SetupMiddleware → MaintenanceMiddleware → DisableBladeIconComponents
→ EnsureUserCanAccessPortalPanel → AuthenticateClusters
Resources are organized into clusters for logical grouping:
| Cluster | Resources |
|---|---|
| RecruitmentCluster | Vacancies, Applicants, Candidates, Stages, Pipelines |
| SystemSettings | General settings, Theme, Localization |
Key Files
| File | Purpose |
|---|---|
app/Providers/Filament/PortalPanelProvider.php | Portal panel config, middleware, theme, resources |
app/Providers/Filament/EducationPanelProvider.php | Education panel config, middleware, theme |
app/Filament/Resources/ | All Filament resources organized by domain |
app/Filament/Forms/Components/ | Custom form components |
app/Filament/Schemas/Components/ | Custom infolist components |
app/Filament/Clusters/ | Resource cluster groupings |
config/filament-shield.php | Role-based permission settings |