Fixes for default country
This commit is contained in:
parent
dd2f9cf545
commit
ed75514646
2 changed files with 6 additions and 4 deletions
|
|
@ -238,7 +238,8 @@ class BillingPortalPurchase extends Component
|
|||
{
|
||||
$company = $this->subscription->company;
|
||||
$user = $this->subscription->user;
|
||||
|
||||
$user->setCompany($company);
|
||||
|
||||
$client_repo = new ClientRepository(new ClientContactRepository());
|
||||
|
||||
$data = [
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ namespace App\Repositories;
|
|||
|
||||
use App\Factory\ClientFactory;
|
||||
use App\Models\Client;
|
||||
use App\Models\Company;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
|
||||
|
|
@ -59,10 +60,10 @@ class ClientRepository extends BaseRepository
|
|||
}
|
||||
|
||||
$client->fill($data);
|
||||
|
||||
|
||||
if(auth()->user() && !$client->country_id){
|
||||
$client->country_id = auth()->user()->company()->settings->country_id;
|
||||
if(!$client->country_id){
|
||||
$company = Company::find($client->company_id);
|
||||
$client->country_id = $company->settings->country_id;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue