mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Set client language_id if locale is present
This commit is contained in:
parent
3bcb65efc2
commit
d98165a8dd
@ -19,6 +19,7 @@ use App\Repositories\ClientContactRepository;
|
|||||||
use App\Repositories\ClientRepository;
|
use App\Repositories\ClientRepository;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class BillingPortalPurchase extends Component
|
class BillingPortalPurchase extends Component
|
||||||
@ -182,12 +183,23 @@ class BillingPortalPurchase extends Component
|
|||||||
|
|
||||||
$client_repo = new ClientRepository(new ClientContactRepository());
|
$client_repo = new ClientRepository(new ClientContactRepository());
|
||||||
|
|
||||||
$client = $client_repo->save([
|
$data = [
|
||||||
'name' => 'Client Name',
|
'name' => 'Client Name',
|
||||||
'contacts' => [
|
'contacts' => [
|
||||||
['email' => $this->email],
|
['email' => $this->email],
|
||||||
]
|
],
|
||||||
], ClientFactory::create($company->id, $user->id));
|
'settings' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
if (array_key_exists('locale', $this->request_data)) {
|
||||||
|
$record = DB::table('languages')->where('locale', $this->request_data['locale'])->first();
|
||||||
|
|
||||||
|
if ($record) {
|
||||||
|
$data['settings']['language_id'] = (string)$record->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$client = $client_repo->save($data, ClientFactory::create($company->id, $user->id));
|
||||||
|
|
||||||
return $client->contacts->first();
|
return $client->contacts->first();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user