]> git.localhorst.tv Git - alttp.git/blob - app/Models/Episode.php
better schedule start
[alttp.git] / app / Models / Episode.php
1 <?php
2
3 namespace App\Models;
4
5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model;
7
8 class Episode extends Model
9 {
10
11         use HasFactory;
12
13         public function channels() {
14                 return $this->belongsToMany(Channel::class)
15                         ->using(Restream::class)
16                         ->withPivot('accept_comms', 'accept_tracker');
17         }
18
19         public function crew() {
20                 return $this->hasMany(EpisodeCrew::class);
21         }
22
23         public function confirmedCrew() {
24                 return $this->crew()->where('confirmed', true);
25         }
26
27         public function event() {
28                 return $this->belongsTo(Event::class);
29         }
30
31         public function players() {
32                 return $this->hasMany(EpisodePlayer::class);
33         }
34
35         protected $casts = [
36                 'confirmed' => 'boolean',
37                 'start' => 'datetime',
38         ];
39
40         protected $hidden = [
41                 'created_at',
42                 'updated_at',
43         ];
44
45 }