From: Daniel Karbach Date: Mon, 20 Feb 2023 18:33:37 +0000 (+0100) Subject: add admin subclass X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=8f82545b35219e093ea60e304699b61fb63966f2;p=alttp.git add admin subclass --- diff --git a/app/Http/Controllers/EpisodeController.php b/app/Http/Controllers/EpisodeController.php index b59ea18..c20ad64 100644 --- a/app/Http/Controllers/EpisodeController.php +++ b/app/Http/Controllers/EpisodeController.php @@ -25,7 +25,7 @@ class EpisodeController extends Controller ->where('events.visible', '=', true) ->orderBy('episodes.start') ->limit(1000); - if ($request->user() && $request->user()->isAdmin()) { + if ($request->user() && $request->user()->isPrivileged()) { $episodes = $episodes->with('crew'); } else { $episodes = $episodes->with([ diff --git a/app/Models/User.php b/app/Models/User.php index fb21113..201361e 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -44,6 +44,10 @@ class User extends Authenticatable return $this->role === 'admin'; } + public function isPrivileged() { + return $this->role === 'special' || $this->isAdmin(); + } + public function isApplicant(Tournament $tournament) { foreach ($tournament->applications as $applicant) { if ($applicant->user_id == $this->id) {