Use the null-safe property accessor for new-user creation

This commit is contained in:
Brady Wetherington 2024-08-29 14:09:23 +01:00
parent b64ed254e0
commit da1e383295

View file

@ -37,7 +37,7 @@ class SaveUserRequest extends FormRequest
'company_id' => [
// determines if the user is being moved between companies and checks to see if they have any items assigned
function ($attribute, $value, $fail) {
if (($this->has('company_id')) && ($this->user->allAssignedCount() > 0) && (Setting::getSettings()->full_multiple_companies_support)) {
if (($this->has('company_id')) && ($this->user?->allAssignedCount() > 0) && (Setting::getSettings()->full_multiple_companies_support)) {
$fail(trans('admin/users/message.error.multi_company_items_assigned'));
}
}