Skip to main content
The 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 (extends Model)
  • TConfiguration - The resource configuration class (extends ResourceConfiguration)

Static Methods

form()

Define the form schema for the resource.
Schema
The schema instance to configure with form components.
Schema
Returns the configured schema.
Example:

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.
Example:

configureTable()

Configure the table with model metadata and authorization.
Table
The table instance to configure.
This method automatically configures the table with model labels, record titles, and reorder authorization.

getEloquentQuery()

Get the base Eloquent query for the resource.
Builder<TModel>
Returns an Eloquent query builder for the resource’s model.
Example:

getModel()

Get the Eloquent model class name for this resource.
class-string<TModel>
Returns the fully qualified model class name.
Example:

getRelations()

Get the relation managers for this resource.
array<class-string<RelationManager> | RelationGroup | RelationManagerConfiguration>
Returns an array of relation manager configurations.
Example:

getWidgets()

Get the widgets for this resource.
array<class-string<Widget>>
Returns an array of widget class names.
Example:

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

Controls whether this resource is automatically discovered by Filament.

$model

The Eloquent model class associated with this resource.

Traits

The Resource class uses multiple traits for additional functionality:
  • BelongsToCluster - Cluster organization
  • BelongsToParent - Parent-child resource relationships
  • BelongsToTenant - Multi-tenancy support
  • CanGenerateUrls - URL generation for resource pages
  • HasAuthorization - Authorization policies
  • HasBreadcrumbs - Breadcrumb generation
  • HasConfiguration - Configuration management
  • HasGlobalSearch - Global search integration
  • HasLabels - Model label configuration
  • HasNavigation - Navigation item configuration
  • HasPages - Page management
  • HasRoutes - Route registration
  • Macroable - Macro support for extending functionality
  • Page - Resource pages
  • Table - Table builder
  • Form - Form builder