Show a NavigationItem to admins only
I use a closure to ensure some navigation items are visible to admins only:
Unfortunately this makes it impossible to use . What would be a better way of doing this?
8 Replies
What error are you getting with
route:cache
? I'm not sure I see the connection...Cannot assign Laravel\SerializableClosure\Serializers\Native to property Filament\Navigation\NavigationItem::$isVisible of type Closure|bool
Replacing the closure with a simple true or false avoids the error.
Where in your codebase are you building your nav items? Can you share a bit more code around it?
I used this in a PanelProvider:
Wow, can't even test this on my end...
route:cache
is crashing with a Segmentation fault 😦
Which version are you on specifically?v3.0.0-beta10. The segfault can be fixed with this: https://github.com/livewire/livewire/pull/6008 (My error also occurs without this fix. In my case I hit the error prior to the other segfault error occurring).
GitHub
[v3] Fix route caching by gehrisandro · Pull Request #6008 · livewi...
This PR fixes Laravel route caching. This problem has been mentioned in #5910 and #6000
Test implementation taken from here and sightly modified: #5910
Re-tried with beta17 just now. Still the same.