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.The schema instance to configure with form components.
Returns the configured schema.
infolist()
Define the infolist schema for displaying record details.The schema instance to configure with infolist entries.
Returns the configured schema.
table()
Define the table schema for listing records.The table instance to configure with columns, filters, and actions.
Returns the configured table.
configureTable()
Configure the table with model metadata and authorization.The table instance to configure.
getEloquentQuery()
Get the base Eloquent query for the resource.Returns an Eloquent query builder for the resource’s model.
getModel()
Get the Eloquent model class name for this resource.Returns the fully qualified model class name.
getRelations()
Get the relation managers for this resource.Returns an array of relation manager configurations.
getWidgets()
Get the widgets for this resource.Returns an array of widget class names.
isEmailVerificationRequired()
Check if email verification is required for this resource.The panel instance.
Returns
true if email verification is required.isDiscovered()
Check if this resource should be automatically discovered by Filament.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