diff --git a/app/Models/Trace/ModeratorAction.php b/app/Models/Trace/ModeratorAction.php index 14cf979..7ea291f 100644 --- a/app/Models/Trace/ModeratorAction.php +++ b/app/Models/Trace/ModeratorAction.php @@ -4,7 +4,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; - class ModeratorAction extends Model { use HasFactory; @@ -43,7 +42,7 @@ public function formatted() : string } /** - * Timeout/untimeout + * Timeouts */ if ($cmd === 'timeout') { $duration = $this->timeout_duration; diff --git a/app/Models/User.php b/app/Models/User.php index f68c762..f33f448 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -43,7 +43,9 @@ class User extends Authenticatable * * @var array */ - protected $casts = []; + protected $casts = [ + 'is_admin' => 'boolean', + ]; /** * Get the channel permissions for the user. @@ -86,6 +88,8 @@ public function getTraceChannels() : Collection if (! $this->isAdmin()) { $permissionChannelIds = $this->channelPermissions()->pluck('channel_provider_id')->toArray(); + $permissionChannelIds[] = $this->provider_id; + $channels = $channels->whereIn('channel_id', $permissionChannelIds); } @@ -99,6 +103,6 @@ public function getTraceChannels() : Collection */ public function isAdmin() : bool { - return $this->is_admin === 1; + return $this->is_admin; } }