Skip to main content

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 the App\Models\Customer model:
This creates several files in app/Filament/Resources:
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:
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:
This is used in:
  • 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:
For dynamic labels:
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 with getEloquentQuery(). Override it to apply global constraints:
packages/panels/src/Resources/Resource.php

Disabling Global Scopes

Remove all global scopes:
Or remove specific scopes:

Generating URLs

Use getUrl() 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 navigation
  • create() - Controls access to Create page
  • update() - Controls access to Edit page
  • view() - Controls access to View page
  • delete() - Controls delete actions
  • deleteAny() - Controls bulk delete actions
  • forceDelete() / forceDeleteAny() - Controls force delete for soft-deleted records
  • restore() / restoreAny() - Controls restore for soft-deleted records
If you have a model policy, you must return true from viewAny() for the resource to appear in navigation.

Skipping Authorization

Pages

Resources consist of multiple pages defined in getPages():
You can delete pages you don’t need. Just remove the file and its entry from 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.