From: Daniel Karbach Date: Thu, 2 Mar 2023 15:43:47 +0000 (+0100) Subject: limit chat command to confirmed crew X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=4d1002bb1c326adfa751666e843d8af686069e13;p=alttp.git limit chat command to confirmed crew --- diff --git a/app/Models/Episode.php b/app/Models/Episode.php index 2084a32..1c16f7f 100644 --- a/app/Models/Episode.php +++ b/app/Models/Episode.php @@ -20,6 +20,10 @@ class Episode extends Model return $this->hasMany(EpisodeCrew::class); } + public function confirmedCrew() { + return $this->crew()->where('confirmed', true); + } + public function event() { return $this->belongsTo(Event::class); } diff --git a/app/TwitchBot/CrewCommand.php b/app/TwitchBot/CrewCommand.php index 2fd0426..85edfb2 100644 --- a/app/TwitchBot/CrewCommand.php +++ b/app/TwitchBot/CrewCommand.php @@ -8,7 +8,7 @@ class CrewCommand extends ChatCommand { $episode = $this->channel->getCurrentEpisode(); if (!$episode) return; $links = []; - foreach ($episode->crew as $crew) { + foreach ($episode->confirmedCrew as $crew) { $link = $crew->getStreamLink(); if (empty($link)) { $link = $crew->getName();