Filament Custom Homepage with Dynamic Sections

Some projects require dynamic controls for their homepage. You might want to show/hide page sections or change the number of records seen dynamically. This example shows you how to do that.

FilamentExamples ThumbBase (8)

Get the Source Code:

How it works

All the management is in the HomepageSectionResource Filament resource

app/Filament/Resources/HomepageSectionResource.php:

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->required(),
// ...
Forms\Components\Select::make('type')
->required()
->options([
'popular' => 'Popular Recipes',
'latest' => 'Latest Recipes',
'category' => 'Category Based',
])
->live(),
// Conditionally show category selection for category-based sections
Forms\Components\Select::make('category_slug')
->label('Category')
->options(fn () => Category::pluck('name', 'slug'))
->visible(fn (Forms\Get $get) => $get('type') === 'category'),
// ...
Forms\Components\Toggle::make('visible')
->label('Show on Homepage')
->default(true),
]);
}

Next, we will implement:

  • Custom Homepage
  • Custom List retrieved from the Homepage Section Resource
The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.
Get the Source Code: All 76 Premium Examples for $99