diff --git a/app/Models/Company.php b/app/Models/Company.php index 3625fbf5fd..3419a2f9ad 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -129,7 +129,7 @@ final class Company extends Model public static function scopeCompanyables($query, $column = 'company_id') { - if (!static::isFullMultipleCompanySupportEnabled() || Auth::user()->isSuperUser()) { + if (!static::isFullMultipleCompanySupportEnabled() || (Auth::check() && Auth::user()->isSuperUser())) { return $query; } else { return static::scopeCompanyablesDirectly($query, $column);