X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FEpisode.php;h=4b8a96a53e2061f527db4d88d089ac411f90e1d9;hb=6a1dfa72436b2f5e5b34485da7d7ef1053d89ccc;hp=ddd92a6dd111e18715ca938101c79271720e59f6;hpb=15132749249f6418fd5695547b5c323a0ad10939;p=alttp.git diff --git a/app/Models/Episode.php b/app/Models/Episode.php index ddd92a6..4b8a96a 100644 --- a/app/Models/Episode.php +++ b/app/Models/Episode.php @@ -11,7 +11,21 @@ class Episode extends Model use HasFactory; public function channels() { - return $this->belongsToMany(Channel::class); + return $this->belongsToMany(Channel::class) + ->using(Restream::class) + ->withPivot('accept_comms', 'accept_tracker'); + } + + public function crew() { + return $this->hasMany(EpisodeCrew::class); + } + + public function confirmedCrew() { + return $this->crew()->where('confirmed', true); + } + + public function confirmedCrewOfChannel(Channel $channel) { + return $this->confirmedCrew()->where('channel_id', '=', $channel->id); } public function event() { @@ -29,7 +43,6 @@ class Episode extends Model protected $hidden = [ 'created_at', - 'ext_id', 'updated_at', ];