permissionStore->has($organization, $permission)) { throw new AuthorizationException(); } } protected function hasPermission(Organization $organization, string $permission): bool { return $this->permissionStore->has($organization, $permission); } /** * @throws AuthorizationException */ protected function user(): User { /** @var User|null $user */ $user = Auth::user(); if ($user === null) { Log::error('This function should only be called in authenticated context'); throw new AuthorizationException(); } return $user; } }