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.

public function getTabs(): array
{
    return match(auth()->user()->role->name) {
      'admin' => [
          // Add your tabs here
      ],
      default => []
    };
}
Was this page helpful?