With Filament, we can create multiple panels in one application. In this example, we'll use Filament v4 to do just that.
In this example, we have three different panels and a front-end homepage:
Let's start with the Admin panel:
Here, we have two main CRUDs: Tasks and Users. For tasks, we have a complete management form:
app/Filament/Resources/Tasks/TaskResource.php
class TaskResource extends Resource{ protected static ?string $model = Task::class; protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-clipboard-document-list'; protected static ?int $navigationSort = 1; protected static ?string $recordTitleAttribute = 'title'; protected static ?string $navigationLabel = 'Tasks'; protected static ?string $pluralModelLabel = 'Tasks'; public static function form(Schema $schema): Schema { return TaskForm::configure($schema); } public static function infolist(Schema $schema): Schema { return TaskInfolist::configure($schema); } public static function table(Table $table): Table { return TasksTable::configure($table); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => ListTasks::route('/'), 'create' => CreateTask::route('/create'), 'view' => ViewTask::route('/{record}'), 'edit' => EditTask::route('/{record}/edit'), ]; } public static function getGloballySearchableAttributes(): array { return ['title', 'pickup_address', 'dropoff_address', 'description']; } public static function getGlobalSearchResultDetails(Model $record): array { return [ 'Customer' => $record->customer?->name, 'Driver' => $record->driver?->user?->name ?? 'Unassigned', 'Status' => $record->status?->name, 'Price' => $record->estimated_price ? '$' . number_format($record->estimated_price, 2) : 'N/A', ]; } public static function getEloquentQuery(): Builder { return parent::getEloquentQuery()->with(['customer', 'driver.user', 'status']); }}
As you can see, with Filament v4, we don't have the Form or the Table in our Resource file. Instead, they live in their own files:
app/Filament/Resources/Tasks/Schemas/TaskForm.php
class TaskForm{ public static function configure(Schema $schema): Schema { return $schema ->components([ Section::make('Task Information') ->schema([ TextInput::make('title') ->required() ->maxLength(255) ->columnSpanFull(), // ...}
Next, we will create: