X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FEpisodePlayer.php;h=26ccc044950d9bedd1dcc08203c9f4e58ea09bd6;hb=HEAD;hp=46a064b5aa47ea6836879abdbdbfba0140451ffd;hpb=071885a30f24b980699b337d9cdb65952f8c6c42;p=alttp.git diff --git a/app/Models/EpisodePlayer.php b/app/Models/EpisodePlayer.php index 46a064b..26ccc04 100644 --- a/app/Models/EpisodePlayer.php +++ b/app/Models/EpisodePlayer.php @@ -17,8 +17,38 @@ 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', + ]; + protected $hidden = [ 'created_at', + 'ext_id', 'updated_at', ];