Force client country if none set

This commit is contained in:
= 2021-06-10 20:18:01 +10:00
parent 3b34553007
commit 769ab49458
2 changed files with 10 additions and 1 deletions

View File

@ -379,6 +379,15 @@ class ClientController extends BaseController
$client->load('contacts', 'primary_contact');
/* Set the client country to the company if none is set */
if(!$client->country_id && strlen($client->company->settings->country_id) > 1){
$client->country_id = $client->company->settings->country_id;
$client->save();
}
$this->uploadLogo($request->file('company_logo'), $client->company, $client);
event(new ClientWasCreated($client, $client->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));

View File

@ -67,7 +67,7 @@ class ClientRepository extends BaseRepository
if (empty($data['name'])) {
$data['name'] = $client->present()->name();
}
$client->save();
$this->contact_repo->save($data, $client);