need help with log-viewer in filasment 3 panel
->navigationItems([NavigationItem::make('შეცდომების ლოგი')->url('/log-viewer', shouldOpenInNewTab: false)->icon('fontisto-world')->group('აუდიტი')->sort(10)])
need this nav see onlky user->role('admin')
2 Replies
find answer ->visible(fn(): bool => auth()->check() && auth()->user()->role === 'TaskingAdmin')
Hey there, not suer if this is exactly the same but I have the log-viewer package set up as an ambedded page restricted to admins
<?php
namespace App\Filament\Pages;
use Filament\Pages\Page;
class LogViewerDashboard extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static string $view = 'filament.pages.log-viewer-dashboard';
protected static ?string $title = '';
public static function shouldRegisterNavigation(): bool
{
return auth()->user()->hasRole('SysOp');
}
public static function canAccess(): bool
{
return auth()->user()->hasRole('SysOp');
}
public static function getNavigationGroup(): ?string
{
return 'SysOp Tools';
}
public static function getNavigationLabel(): string
{
return 'Log Viewer';
}
}
and then the view has log viewer embedded in an iframe