From a3e960cbba4d277ef96270095675eafa45dcdda8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 3 Mar 2020 23:18:24 +1100 Subject: [PATCH] Fixes for currency id insertion in new client (#3413) --- app/Http/Requests/Client/StoreClientRequest.php | 2 +- app/Models/User.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Requests/Client/StoreClientRequest.php b/app/Http/Requests/Client/StoreClientRequest.php index 0fb8412dc86a..417f9655070e 100644 --- a/app/Http/Requests/Client/StoreClientRequest.php +++ b/app/Http/Requests/Client/StoreClientRequest.php @@ -81,7 +81,7 @@ class StoreClientRequest extends Request $input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']); } - if(empty($input['settings']->currency_id)) + if(empty($input['settings']) || empty($input['settings']->currency_id)) { if(empty($input['group_settings_id'])) { diff --git a/app/Models/User.php b/app/Models/User.php index ea50234eca1a..94c43c2fc79c 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -183,7 +183,7 @@ class User extends Authenticatable implements MustVerifyEmail public function company_user() { - if (!$this->id) { + if (!$this->id && auth()->user()) { $this->id = auth()->user()->id; }