X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=app%2FModels%2FChannel.php;h=8045a4194fa529561ba6a091c0aa7770beb18dce;hb=948653e5ae0412fbbee7945175470e328910245f;hp=5c7ae70c0e95ebfec714052becfc28580dc1f354;hpb=1d3c8c6a96fc45d839f0e3719baca790059d189f;p=alttp.git diff --git a/app/Models/Channel.php b/app/Models/Channel.php index 5c7ae70..8045a41 100644 --- a/app/Models/Channel.php +++ b/app/Models/Channel.php @@ -32,10 +32,14 @@ class Channel extends Model { } public function randomOfClass($class) { - $line = $this->queryChatlog() + if (is_array($class)) { + return $this->queryChatlog() + ->whereIn('classification', $class) + ->first(); + } + return $this->queryChatlog() ->where('classification', '=', $class) ->first(); - return $line ? $line->text_content : ''; } public function queryChatlog() { @@ -241,6 +245,10 @@ class Channel extends Model { return Arr::join($entries, ', ', ' and '); } + public function chat_bot_logs() { + return $this->hasMany(ChatBotLog::class); + } + public function crews() { return $this->hasMany(ChannelCrew::class); }