What are Resources?
Resources are static classes that build complete CRUD (Create, Read, Update, Delete) interfaces for your Eloquent models. They describe how administrators interact with data using forms, tables, and pages. Each resource in Filament:- Connects to an Eloquent model
- Defines form schemas for creating and editing records
- Configures table layouts for listing records
- Manages multiple pages (List, Create, Edit, View)
- Handles relationships with other models
Resources use a declarative API pattern. You define what you want, and Filament handles the implementation details.
Creating a Resource
To create a resource for theApp\Models\Customer model:
app/Filament/Resources:
- Simple Resource
- With View Page
- With Soft Deletes
For models that only need basic CRUD in modals:This creates a single “Manage” page with modal-based create/edit operations.
Resource Structure
The Resource Class
Your main resource class (CustomerResource.php) contains configuration and references to other components:
packages/panels/src/Resources/Resource.php
Form Schemas
Forms define how users create and edit records. By default, form definitions live in separate schema files:Inline form definitions
Inline form definitions
You can also define forms directly in the resource class:
Tables
Tables display records on the List page. Like forms, they can be defined in separate files or inline:Record Titles
Set a$recordTitleAttribute to identify records throughout the UI:
- Global search results
- Breadcrumbs
- Delete confirmation modals
- Relationship selects
You can specify an Eloquent accessor if a single column isn’t sufficient.
Model Labels
Filament automatically generates labels from your model name. Customize them if needed:Navigation
Resources automatically appear in the navigation menu. Customize the navigation item:1
Set the icon
Use any Blade component name. Heroicons are included by default.
2
Group related items
Group multiple resources under a common label:
3
Control the order
Lower numbers appear first:
Customizing the Eloquent Query
Every query to your resource starts withgetEloquentQuery(). Override it to apply global constraints:
packages/panels/src/Resources/Resource.php
Disabling Global Scopes
Remove all global scopes:Generating URLs
UsegetUrl() to generate URLs to resource pages:
URLs for Modals
Generate URLs that open modals:Authorization
Filament respects Laravel model policies:viewAny()- Controls resource visibility in navigationcreate()- Controls access to Create pageupdate()- Controls access to Edit pageview()- Controls access to View pagedelete()- Controls delete actionsdeleteAny()- Controls bulk delete actionsforceDelete()/forceDeleteAny()- Controls force delete for soft-deleted recordsrestore()/restoreAny()- Controls restore for soft-deleted records
Skipping Authorization
Pages
Resources consist of multiple pages defined ingetPages():
getPages().
Auto-Generating Resources
Filament can inspect your database and generate forms and tables automatically:This works best with well-structured databases that follow Laravel conventions.