diff --git a/app/Repositories/ClientRepository.php b/app/Repositories/ClientRepository.php index 5074e2976ba4..7dd720c0fd00 100644 --- a/app/Repositories/ClientRepository.php +++ b/app/Repositories/ClientRepository.php @@ -58,7 +58,7 @@ class ClientRepository extends BaseRepository return $client; } - if(!$client->id && (!array_key_exists('country_id', $data) || empty($data['country_id']))){ + if(!$client->id && auth()->user() && auth()->user()->company() && (!array_key_exists('country_id', $data) || empty($data['country_id']))){ $data['country_id'] = auth()->user()->company()->settings->country_id; } diff --git a/database/schema/db-ninja-01-schema.dump b/database/schema/db-ninja-01-schema.dump index 3cd2f293f54b..7e27ead7077a 100644 --- a/database/schema/db-ninja-01-schema.dump +++ b/database/schema/db-ninja-01-schema.dump @@ -1044,7 +1044,7 @@ CREATE TABLE `migrations` ( `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS `password_resets`; /*!40101 SET @saved_cs_client = @@character_set_client */;