Resource class is the foundation for creating CRUD (Create, Read, Update, Delete) interfaces for Eloquent models in Filament. Resources define the schema for forms, tables, and additional functionality like relation managers and widgets.
Namespace
Type Parameters
TModel- The Eloquent model class (extendsModel)TConfiguration- The resource configuration class (extendsResourceConfiguration)
Static Methods
form()
Define the form schema for the resource.Schema
The schema instance to configure with form components.
Schema
Returns the configured schema.
infolist()
Define the infolist schema for displaying record details.Schema
The schema instance to configure with infolist entries.
Schema
Returns the configured schema.
table()
Define the table schema for listing records.Table
The table instance to configure with columns, filters, and actions.
Table
Returns the configured table.
configureTable()
Configure the table with model metadata and authorization.Table
The table instance to configure.
getEloquentQuery()
Get the base Eloquent query for the resource.Builder<TModel>
Returns an Eloquent query builder for the resource’s model.
getModel()
Get the Eloquent model class name for this resource.class-string<TModel>
Returns the fully qualified model class name.
getRelations()
Get the relation managers for this resource.array<class-string<RelationManager> | RelationGroup | RelationManagerConfiguration>
Returns an array of relation manager configurations.
getWidgets()
Get the widgets for this resource.array<class-string<Widget>>
Returns an array of widget class names.
isEmailVerificationRequired()
Check if email verification is required for this resource.Panel
The panel instance.
bool
Returns
true if email verification is required.isDiscovered()
Check if this resource should be automatically discovered by Filament.bool
Returns
true if the resource should be discovered.Properties
$isDiscovered
$model
Traits
The Resource class uses multiple traits for additional functionality:BelongsToCluster- Cluster organizationBelongsToParent- Parent-child resource relationshipsBelongsToTenant- Multi-tenancy supportCanGenerateUrls- URL generation for resource pagesHasAuthorization- Authorization policiesHasBreadcrumbs- Breadcrumb generationHasConfiguration- Configuration managementHasGlobalSearch- Global search integrationHasLabels- Model label configurationHasNavigation- Navigation item configurationHasPages- Page managementHasRoutes- Route registrationMacroable- Macro support for extending functionality