How to put the resource creation link in the navigation of the panel?
Hey folks π
I've created a panel for users and I have a
RequestResource
(with default pages). My resource registers well in the navigation (the page to display all Requests
but I would also like a direct link to create a Request
in my navigation. Is there an easy way to do this?
I've tried adding navigation-related statics properties to the App\Filament\User\Resources\RequestResource\CreateRequest.php
page (like $navigationIcon
, $navigationGroup
, etc.) but it doesn't seem to work.
So I tried going through the UserPanelProdiver file and adding this method:
It works, but I don't know how to manage the active class π
Can anyone shed some light on this?
Thanks in advance πSolution:Jump to solution
You could try something along those lines:
```php
NavigationItem::make('New Request')
->label(__( 'users/requests.navigation_create_label' ))...
2 Replies
Solution
You could try something along those lines:
Hey, great it's working thanks ! But it's weird because the active class was also set to the "All requests" item (generated via the RequestResource" class).
So I added this to RequestResource.php:
And add a new Item in my navigation for the ListRequest :
So now it's good. Thanks for your help π