Skip to content

Conditional Custom Navigation by Data Id #14916

Closed Answered by fahmiSD
fahmiSD asked this question in Help
Discussion options

You must be logged in to vote

I found the solution to my issue and wanted to share it in case others face the same problem. The goal is to highlight the correct navigation item based on the specific resource ID (such as 1, 2, or 3).

NavigationItem::make('Hak Pelanggan')
    ->url('/admin/hak-kewajiban-pelanggans/1/edit')
    ->icon('heroicon-o-user-circle')
    ->isActiveWhen(fn (): bool => (
        request()->routeIs('filament.admin.resources.hak-kewajiban-pelanggans.edit') &&
        request()->route()->parameter('record') == 1
    )),

NavigationItem::make('Kewajiban Pelanggan')
    ->url('/admin/hak-kewajiban-pelanggans/2/edit')
    ->icon('heroicon-o-check-circle')
    ->isActiveWhen(fn (): bool => (
        req…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fahmiSD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant