diff --git a/app/Jobs/Common/CreateCompany.php b/app/Jobs/Common/CreateCompany.php index ab417276b..e85bbb7d3 100644 --- a/app/Jobs/Common/CreateCompany.php +++ b/app/Jobs/Common/CreateCompany.php @@ -44,6 +44,11 @@ class CreateCompany extends Job protected function callSeeds() { + // Set custom locale + if ($this->request->has('locale')) { + app()->setLocale($this->request->get('locale')); + } + // Company seeds Artisan::call('company:seed', [ 'company' => $this->company->id diff --git a/app/Jobs/Common/UpdateCompany.php b/app/Jobs/Common/UpdateCompany.php index e376a4c47..0e214d83c 100644 --- a/app/Jobs/Common/UpdateCompany.php +++ b/app/Jobs/Common/UpdateCompany.php @@ -33,17 +33,13 @@ class UpdateCompany extends Job */ public function handle() { - // Check if user can access company $this->authorize(); - // Update company $this->company->update($this->request->all()); - // Clear current settings + // Clear current and load given company settings setting()->setExtraColumns(['company_id' => $this->company->id]); setting()->forgetAll(); - - // Load settings based on the given company setting()->load(true); if ($this->request->has('name')) { diff --git a/resources/views/common/companies/create.blade.php b/resources/views/common/companies/create.blade.php index 715690f26..d7bcd2cd2 100644 --- a/resources/views/common/companies/create.blade.php +++ b/resources/views/common/companies/create.blade.php @@ -23,7 +23,7 @@ {{ Form::selectGroup('currency', trans_choice('general.currencies', 1), 'exchange-alt', $currencies) }} - {{ Form::textGroup('domain', trans('companies.domain'), 'globe', []) }} + {{ Form::selectGroup('locale', trans_choice('general.languages', 1), 'flag', language()->allowed(), setting('default.locale', config('app.locale', 'en-GB')), []) }} {{ Form::textareaGroup('address', trans('general.address')) }} diff --git a/resources/views/common/companies/edit.blade.php b/resources/views/common/companies/edit.blade.php index 6920ea2da..c450d7e7a 100644 --- a/resources/views/common/companies/edit.blade.php +++ b/resources/views/common/companies/edit.blade.php @@ -22,9 +22,9 @@ {{ Form::emailGroup('email', trans('general.email'), 'envelope') }} - {{ Form::selectGroup('currency', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, $company->currency) }} + {{ Form::selectGroup('currency', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, $company->currency ?? 'USD') }} - {{ Form::textGroup('domain', trans('companies.domain'), 'globe', []) }} + {{ Form::selectGroup('locale', trans_choice('general.languages', 1), 'flag', language()->allowed(), $company->locale ?? config('app.locale', 'en-GB'), []) }} {{ Form::textareaGroup('address', trans('general.address')) }}