]> git.localhorst.tv Git - alttp.git/blobdiff - app/Models/Channel.php
first simple twitch commands
[alttp.git] / app / Models / Channel.php
index 8b5ff9007e2359c93bc105cdcd9b7e13fb1f73ce..0536aef36e9638ace6387d2f3fbba3f50c2bcace 100644 (file)
@@ -9,6 +9,13 @@ class Channel extends Model
 {
        use HasFactory;
 
+       public function getCurrentEpisode() {
+               return $this->episodes()
+                       ->where('start', '<', now()->subMinutes(10))
+                       ->orderBy('start', 'DESC')
+                       ->first();
+       }
+
        public function episodes() {
                return $this->belongsToMany(Episode::class)
                        ->using(Restream::class)
@@ -20,6 +27,7 @@ class Channel extends Model
        }
 
        protected $casts = [
+               'chat_commands' => 'array',
                'languages' => 'array',
        ];