The premade dashboard page is mostly enough for general use. But sometimes we might want to change things like icon, heading, navigation label, etc. Let's get it as simple as possible.
<?php namespace App\Filament\Pages; use Filament\Pages\Dashboard as BaseDashboard; class Dashboard extends BaseDashboard{ // Customize properties or methods here}
'pages' => [ 'namespace' => 'App\\Filament\\Pages', 'path' => app_path('Filament/Pages'), 'register' => [ // Pages\Dashboard::class, <-- delete or comment this line. ], ],
That's it. We can now customize our dashboard as we want.
Tips: Check the docs to see everything we can customize.
Example:
<?php namespace App\Filament\Pages; use Filament\Pages\Dashboard as BaseDashboard; class Dashboard extends BaseDashboard{ protected static ?string $navigationIcon = 'phosphor-gauge-duotone'; protected function getHeading(): string { $company = auth()->user()->company->name; return "{$company}'s Dashboard"; }}
No comments yet…