How to grab user's roles in Filament?

I am using Filament Shield and I have assigned a 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)


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?
Solution
Solved it myself
Was this page helpful?