custom dashboard page header heading | add auth user name into the heading of a page

im looking to turn this:
protected ?string $heading = 'Welcome';
protected ?string $heading = 'Welcome';
into something like this:
protected ?string $heading = 'Welcome ' . auth()->user();
protected ?string $heading = 'Welcome ' . auth()->user();
but it doesn't work and haven't found a way to make it use the, currently authenticated user name. base class for Dashboard doesn't have a getHeading method. is it possible?
Solution:
Hi, you have the getHeading() function on Dashboard too :```php class Dashboard extends \Filament\Pages\Dashboard { public function getHeading(): string | Htmlable {...
Jump to solution
5 Replies
Solution
Julien B. (aka yebor974)
Hi, you have the getHeading() function on Dashboard too :
php
class Dashboard extends \Filament\Pages\Dashboard
{
public function getHeading(): string | Htmlable
{
return 'Dashboard of ' . filament()->auth()->user()->name;
}
}
php
class Dashboard extends \Filament\Pages\Dashboard
{
public function getHeading(): string | Htmlable
{
return 'Dashboard of ' . filament()->auth()->user()->name;
}
}
Julien B. (aka yebor974)
Filament Mastery
How to customize page Titles and Headings in Filament Resources - F...
Learn how to set custom page titles and headings in Filament resource pages. Understand the difference and use model data.
warNuttah
warNuttahOP3mo ago
thanks!
warNuttah
warNuttahOP3mo ago
btw, there seems to be an issue with color on your "terms of service" @Julien B. (aka yebor974) will be checking it out for further assistance.
No description

Did you find this page helpful?