© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
4 replies
Wirkhof

How to grab user's roles in Filament?

I am using Filament Shield and I have assigned a role
panel_role
panel_role
to a user.

I want to limit the visibility of a certain form field based on the role of the current user.

For a specific user id (in this case if the user has id 39), this works:

->visible(fn () => auth()->id() === 39)
->visible(fn () => auth()->id() === 39)


And only the user with id 39 sees that form field.

But how to do a condition targeting user's role?

how would the visible method look like in that case? Let's say for the
panel_role
panel_role
?
Solution
Solved it myself
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

how to show roles in user table
FilamentFFilament / ❓┊help
3y ago
How to scope filament-shield roles
FilamentFFilament / ❓┊help
6mo ago
Filament DateTimePicker: How to show default time in user's local timezone?
FilamentFFilament / ❓┊help
8mo ago