hasPermissionTo('teams.view'); } public function create(User $user) { return $user->hasPermissionTo('teams.create'); } public function update(User $user, Team $team) { // Team owners can update their team regardless of perm. // This perm would let admins change all teams return $user->isOwnerOfTeam($team) || $user->hasPermissionTo('teams.update'); } public function invite(User $user, Team $team) { if (!$team->openJoin && $user->isOwnerOfTeam($team) || !$team->openJoin && $user->hasPermissionTo('teams.invite')) { return true; } return false; } public function switchTeam(User $user, Team $team): bool { // is the user in the team they're trying to switch to? return $user->hasTeam($team); } }