]> git.localhorst.tv Git - alttp.git/blobdiff - app/Models/EpisodePlayer.php
first simple twitch commands
[alttp.git] / app / Models / EpisodePlayer.php
index 1125701e4a9f38e15775cd2edbdbf98c1a00a1bd..26ccc044950d9bedd1dcc08203c9f4e58ea09bd6 100644 (file)
@@ -17,6 +17,31 @@ class EpisodePlayer extends Model
                return $this->belongsTo(User::class);
        }
 
+       public function getName() {
+               if (!empty($this->name_override)) {
+                       return $this->name_override;
+               }
+               if ($this->user) {
+                       if (!empty($this->user->nickname)) {
+                               return $this->user->nickname;
+                       }
+                       if (!empty($this->user->username)) {
+                               return $this->user->username;
+                       }
+               }
+               return '';
+       }
+
+       public function getStreamLink() {
+               if (!empty($this->stream_override)) {
+                       return $this->stream_override;
+               }
+               if ($this->user && !empty($this->user->stream_link)) {
+                       return $this->user->stream_link;
+               }
+               return '';
+       }
+
        protected $casts = [
                'user_id' => 'string',
        ];