FilamentF
Filament2y ago
Anik

navigationitems override

Hello, I want to modify the url() in the navigationItem for a page class. right now they are set to static and cannot be overridden in a ListRecord class. I am trying to get Nested resource from this tutorial.
https://laraveldaily.com/post/filament-v3-nested-resources-trait-pages
The list page works as in the tutorial but when I use it with getRecordSubNavigation, it gives this error.
https://flareapp.io/share/LPdK90Qm
Kindly help. 😢
public static function getRecordSubNavigation(Page $page): array
    {
        return $page->generateNavigationItems([
// error from navigationItem::url() on being included here
])
    }


trying to override NavigationItem gives the error
https://flareapp.io/share/Vme190qm
    public static function getNavigationItems(array $urlParameters = []): array

    {

        return [

            NavigationItem::make(static::getNavigationLabel())

                ->group(static::getNavigationGroup())

                ->parentItem(static::getNavigationParentItem())

                ->icon(static::getNavigationIcon())

                ->activeIcon(static::getActiveNavigationIcon())

                // ->isActiveWhen(fn (): bool => request()->routeIs(static::getRouteName()))

                ->sort(static::getNavigationSort())

                ->badge(static::getNavigationBadge(), color: static::getNavigationBadgeColor())

                ->url(fn (): string => EventsResource::getUrl('bookings.index', ['parent' => $this->parent])),

        ];
    }
Was this page helpful?