In this tutorial, we will explore the process of adding a Homepage Link to the Filament Dashboard.
Leveraging Filament's powerful Render Hook system, achieving this is straightforward, requiring just one simple steps:
To begin, open your app/Providers/AppServiceProvider.php
use Filament\Support\Facades\FilamentView;
use Filament\View\PanelsRenderHook;
public function boot(): void
{
//....
FilamentView::registerRenderHook(
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
fn (): string => Blade::render('<a href="/" target="_blank" style="--c-400:var(--primary-400);--c-600:var(--primary-600);" class="inline-flex items-center gap-2 text-sm text-custom-600 dark:text-custom-400"><x-heroicon-o-globe-europe-africa class="h-5 w-5"/> Homepage</a>')
);
}
Alternatively, you can choose to render a view instead of using inline HTML.
FilamentView::registerRenderHook(
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
fn (): string => view('mybutton')->render()
);
The link will be displayed next to the search box: