From 4f12e64cf7df0ce4794f0d4335d5c5e7fcf952d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9ia=20Bohner?= Date: Mon, 2 Mar 2026 21:22:12 -0300 Subject: [PATCH 1/2] Add config to register nav on frontend --- config/filament-help.php | 19 +++++++++++++++++++ .../Frontend/HelpArticleResource.php | 14 ++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/config/filament-help.php b/config/filament-help.php index b030686a..4f203b2b 100644 --- a/config/filament-help.php +++ b/config/filament-help.php @@ -17,6 +17,25 @@ 'model' => \Tapp\FilamentHelp\Models\HelpArticle::class, + /* + |-------------------------------------------------------------------------- + | Frontend Configuration + |-------------------------------------------------------------------------- + | + | Configure the frontend help article resource behaviour. + | + */ + + 'frontend' => [ + 'resource' => [ + /* + * Whether the frontend Help resource appears in the panel navigation. + * Set to false to hide from the topbar and use a custom link (e.g. in the user menu) instead. + */ + 'should_register_navigation' => true, + ], + ], + /* |-------------------------------------------------------------------------- | Tenancy Configuration diff --git a/src/Resources/Frontend/HelpArticleResource.php b/src/Resources/Frontend/HelpArticleResource.php index bf5fc2d4..27de6053 100644 --- a/src/Resources/Frontend/HelpArticleResource.php +++ b/src/Resources/Frontend/HelpArticleResource.php @@ -3,6 +3,7 @@ namespace Tapp\FilamentHelp\Resources\Frontend; use Filament\Actions\ViewAction; +use Filament\Facades\Filament; use Filament\Resources\Resource; use Filament\Support\Enums\Alignment; use Filament\Tables\Columns\Layout\Stack; @@ -26,12 +27,13 @@ public static function getModel(): string public static function shouldRegisterNavigation(): bool { - // Only register navigation if we're on the app panel and routes exist - $panel = \Filament\Facades\Filament::getCurrentPanel(); - if ($panel && $panel->getId() === 'app') { - return true; + if (! config('filament-help.frontend.resource.should_register_navigation', true)) { + return false; } - return false; + + $panel = Filament::getCurrentPanel(); + + return $panel && $panel->getId() === 'app'; } protected static ?string $modelLabel = 'Help Article'; @@ -103,7 +105,7 @@ public static function getEloquentQuery(): \Illuminate\Database\Eloquent\Builder // Apply tenant scoping if enabled if (config('filament-help.tenancy.enabled', false) && config('filament-help.tenancy.scoping.frontend', true)) { - $tenant = \Filament\Facades\Filament::getTenant(); + $tenant = Filament::getTenant(); if ($tenant) { $tenantColumn = config('filament-help.tenancy.column') ?? 'team_id'; $query->where($tenantColumn, $tenant->id); From c1174217159a3866f80f882cb9bdb891671edfca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9ia=20Bohner?= Date: Mon, 2 Mar 2026 21:25:56 -0300 Subject: [PATCH 2/2] Update README --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 65c188eb..d6f0c18a 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ php artisan vendor:publish --tag="filament-help-config" This is the contents of the published config file: ```php + \Tapp\FilamentHelp\Models\HelpArticle::class, + /* + |-------------------------------------------------------------------------- + | Frontend Configuration + |-------------------------------------------------------------------------- + | + | Configure the frontend help article resource behaviour. + | + */ + + 'frontend' => [ + 'resource' => [ + /* + * Whether the frontend Help resource appears in the panel navigation. + * Set to false to hide from the topbar and use a custom link (e.g. in the user menu) instead. + */ + 'should_register_navigation' => true, + ], + ], + /* |-------------------------------------------------------------------------- | Tenancy Configuration