Replies: 1 comment 1 reply
-
public function filters(): array
{
// Available to everyone
$filters = [
'type' => Filter::make('User Type')
->select([
'' => 'Any',
UserTypeEnum::admin()->value => Str::plural(UserTypeEnum::admin()->label),
UserTypeEnum::user()->value => Str::plural(UserTypeEnum::user()->label),
]),
];
// Available to only admins
if (auth()->user()->isAdmin()) {
$filters['2fa'] => Filter::make('Two Factor Authentication')
->select([
'' => 'Any',
'enabled' => 'Enabled',
'disabled' => 'Disabled',
]);
}
return $filters;
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dhruva81
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to show some filters for admin role and hide those filters for other user roles.
Please guide me, how can I show/hide filters based on user roles.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions