Access to route() in AppPanelProvider::panel()

Do we have access to routes in the panel() method before we do a call to $panel?
Solution:
Here is with closure. It works fine. ```php MenuItem::make() ->url(function() { return Account::getUrl();...
Jump to solution
3 Replies
Dennis Koch
Dennis Koch17mo ago
Route shouldn’t be an issue. But I guess you want to access filament routes? First: don’t use route. Use Resource::getUrl() method. Second. Put it in a closure do it’s evaluated later
StanProg
StanProgOP17mo ago
I don't have only resources, for example I have a page and I'm trying to it's the URL with route('filament.pages.account') And the second problem is that I'm calling $panel->userMenuItems($userMenuItems) and these menu items can't be set via closure so I have to define that $userMenuItems before calling $panel and within this defining I have to do something like MenuItem::make()->url(route('filament.pages.account')), so I can't use closure in any way for that. Any other ideas how I can fix this? Doing it with MenuItem::make()->url(Account::getUrl()) generates Call to a member function getId() on null. I will try to pass that as closure...
Solution
StanProg
StanProg17mo ago
Here is with closure. It works fine.
MenuItem::make()
->url(function() {
return Account::getUrl();
})
MenuItem::make()
->url(function() {
return Account::getUrl();
})
Want results from more Discord servers?
Add your server