is there a way to make tabs filter optional according to roles

i have a teacher role and admin role, i want a tab filter only when i login as an admin, if i login as a teacher tab filter on the resource is not showing, is there a way to do that? thanks.
Solution:
Given that the getTabs() method returns the tabs you need as an array, You can easily customize the return value based on the user role. ```php public function getTabs(): array {...
Jump to solution
2 Replies
tuto1902
tuto190211mo ago
That’s an interesting question. I’ll do some digging and let you know. I’m sure we can figure it out together
Solution
tuto1902
tuto190211mo ago
Given that the getTabs() method returns the tabs you need as an array, You can easily customize the return value based on the user role.
public function getTabs(): array
{
return match(auth()->user()->role->name) {
'admin' => [
// Add your tabs here
],
default => []
};
}
public function getTabs(): array
{
return match(auth()->user()->role->name) {
'admin' => [
// Add your tabs here
],
default => []
};
}
Want results from more Discord servers?
Add your server
More Posts