Multiple select filter
How can I apply a filter to hide the admin role in the user level, except for the superadmin? I'm out of my brain. Please don't mind help me. Thank you.
7 Replies
->disabled(fn () => !auth()->user()->is_admin)
or hidden
or check this, I am not sure what you want https://filamentphp.com/docs/2.x/forms/fields#populating-automatically-from-a-relationship
let me check
w8 I don't need hidden or disable.
just hide the superadmin
So in you roles select you want to load roles which doesn't contain "super_admin" right?
yes
Select::make('roles')
->relationship('roles', 'name', fn (Builder $query) => $query->where('name', '!=', 'ADMin"))
Thank you so here is my final code