From da1e383295d6ee3940d6842979a73c1f14e6ff9a Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Thu, 29 Aug 2024 14:09:23 +0100 Subject: [PATCH] Use the null-safe property accessor for new-user creation --- app/Http/Requests/SaveUserRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Requests/SaveUserRequest.php b/app/Http/Requests/SaveUserRequest.php index e16826d16..f778d016d 100644 --- a/app/Http/Requests/SaveUserRequest.php +++ b/app/Http/Requests/SaveUserRequest.php @@ -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')); } }