]> git.localhorst.tv Git - alttp.git/blobdiff - app/Models/Channel.php
chat bot settings
[alttp.git] / app / Models / Channel.php
index d68ba5884888838271dbceac3e9ab8b3a3314c4f..d1f0fdc784d4f4e0f4078be186322b4a54901bd8 100644 (file)
@@ -9,12 +9,33 @@ class Channel extends Model
 {
        use HasFactory;
 
+       public function getCurrentEpisode() {
+               return $this->episodes()
+                       ->where('start', '<', now()->subMinutes(10))
+                       ->orderBy('start', 'DESC')
+                       ->first();
+       }
+
+       public function crews() {
+               return $this->hasMany(ChannelCrew::class);
+       }
+
+       public function episodes() {
+               return $this->belongsToMany(Episode::class)
+                       ->using(Restream::class)
+                       ->withPivot('accept_comms', 'accept_tracker');
+       }
+
        public function organization() {
                return $this->belongsTo(Organization::class);
        }
 
        protected $casts = [
+               'chat' => 'boolean',
+               'chat_commands' => 'array',
+               'chat_settings' => 'array',
                'languages' => 'array',
+               'join' => 'boolean',
        ];
 
        protected $hidden = [