Skip superuser check if the user isn't logged in

This commit is contained in:
snipe 2016-06-13 19:05:29 -07:00
parent 0fd43c0a5d
commit c29984d0df

View file

@ -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);