mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 05:47:28 -08:00
Only try to get the company if there is an auth’d user
(Needed for command line tools, where no Auth::user() is present)
This commit is contained in:
parent
ec6ed256fb
commit
45afe725a1
|
@ -128,9 +128,12 @@ final class Company extends SnipeModel
|
|||
} elseif (!static::isFullMultipleCompanySupportEnabled()) {
|
||||
return true;
|
||||
} else {
|
||||
$current_user_company_id = Auth::user()->company_id;
|
||||
$companyable_company_id = $companyable->company_id;
|
||||
return ($current_user_company_id == null || $current_user_company_id == $companyable_company_id || Auth::user()->isSuperUser());
|
||||
if (Auth::user()) {
|
||||
$current_user_company_id = Auth::user()->company_id;
|
||||
$companyable_company_id = $companyable->company_id;
|
||||
return ($current_user_company_id == null || $current_user_company_id == $companyable_company_id || Auth::user()->isSuperUser());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue