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

Filament\Resources\Resource

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.
public static function form(Schema $schema): Schema
schema
Schema
The schema instance to configure with form components.
return
Schema
Returns the configured schema.
Example:
use Filament\Schemas\Schema;
use Filament\Forms\Components\TextInput;

public static function form(Schema $schema): Schema
{
    return $schema
        ->components([
            TextInput::make('name')->required(),
            TextInput::make('email')->email(),
        ]);
}

infolist()

Define the infolist schema for displaying record details.
public static function infolist(Schema $schema): Schema
schema
Schema
The schema instance to configure with infolist entries.
return
Schema
Returns the configured schema.

table()

Define the table schema for listing records.
public static function table(Table $table): Table
table
Table
The table instance to configure with columns, filters, and actions.
return
Table
Returns the configured table.
Example:
use Filament\Tables\Table;
use Filament\Tables\Columns\TextColumn;

public static function table(Table $table): Table
{
    return $table
        ->columns([
            TextColumn::make('name')->searchable(),
            TextColumn::make('email'),
        ]);
}

configureTable()

Configure the table with model metadata and authorization.
public static function configureTable(Table $table): void
table
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.
public static function getEloquentQuery(): Builder
return
Builder<TModel>
Returns an Eloquent query builder for the resource’s model.
Example:
public static function getEloquentQuery(): Builder
{
    return parent::getEloquentQuery()
        ->where('status', 'active');
}

getModel()

Get the Eloquent model class name for this resource.
public static function getModel(): string
return
class-string<TModel>
Returns the fully qualified model class name.
Example:
protected static ?string $model = User::class;

getRelations()

Get the relation managers for this resource.
public static function getRelations(): array
return
array<class-string<RelationManager> | RelationGroup | RelationManagerConfiguration>
Returns an array of relation manager configurations.
Example:
public static function getRelations(): array
{
    return [
        RelationManagers\PostsRelationManager::class,
    ];
}

getWidgets()

Get the widgets for this resource.
public static function getWidgets(): array
return
array<class-string<Widget>>
Returns an array of widget class names.
Example:
public static function getWidgets(): array
{
    return [
        Widgets\UserStatsWidget::class,
    ];
}

isEmailVerificationRequired()

Check if email verification is required for this resource.
public static function isEmailVerificationRequired(Panel $panel): bool
panel
Panel
The panel instance.
return
bool
Returns true if email verification is required.

isDiscovered()

Check if this resource should be automatically discovered by Filament.
public static function isDiscovered(): bool
return
bool
Returns true if the resource should be discovered.

Properties

$isDiscovered

protected static bool $isDiscovered = true;
Controls whether this resource is automatically discovered by Filament.

$model

protected static ?string $model = null;
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

Build docs developers (and LLMs) love