mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-17 16:42:48 +01:00
Added language seeder
This commit is contained in:
parent
9f8865d0f2
commit
501958cc1e
@ -266,18 +266,7 @@ class AppController extends BaseController
|
||||
Cache::flush();
|
||||
Session::flush();
|
||||
Artisan::call('migrate', array('--force' => true));
|
||||
foreach ([
|
||||
'PaymentLibraries',
|
||||
'Fonts',
|
||||
'Banks',
|
||||
'InvoiceStatus',
|
||||
'Currencies',
|
||||
'DateFormats',
|
||||
'InvoiceDesigns',
|
||||
'PaymentTerms',
|
||||
] as $seeder) {
|
||||
Artisan::call('db:seed', array('--force' => true, '--class' => "{$seeder}Seeder"));
|
||||
}
|
||||
Artisan::call('db:seed', array('--force' => true, '--class' => "UpdateSeeder"));
|
||||
Event::fire(new UserSettingsChanged());
|
||||
Session::flash('message', trans('texts.processed_updates'));
|
||||
} catch (Exception $e) {
|
||||
|
@ -23,5 +23,6 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call('DateFormatsSeeder');
|
||||
$this->call('InvoiceDesignsSeeder');
|
||||
$this->call('PaymentTermsSeeder');
|
||||
$this->call('LanguageSeeder');
|
||||
}
|
||||
}
|
||||
|
41
database/seeds/LanguageSeeder.php
Normal file
41
database/seeds/LanguageSeeder.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Language;
|
||||
|
||||
class LanguageSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
|
||||
$languages = [
|
||||
['name' => 'English', 'locale' => 'en'],
|
||||
['name' => 'Italian', 'locale' => 'it'],
|
||||
['name' => 'German', 'locale' => 'de'],
|
||||
['name' => 'French', 'locale' => 'fr'],
|
||||
['name' => 'Brazilian Portuguese', 'locale' => 'pt_BR'],
|
||||
['name' => 'Dutch', 'locale' => 'nl'],
|
||||
['name' => 'Spanish', 'locale' => 'es'],
|
||||
['name' => 'Norwegian', 'locale' => 'nb_NO'],
|
||||
['name' => 'Danish', 'locale' => 'da'],
|
||||
['name' => 'Japanese', 'locale' => 'ja'],
|
||||
['name' => 'Swedish', 'locale' => 'sv'],
|
||||
['name' => 'Spanish - Spain', 'locale' => 'es_ES'],
|
||||
['name' => 'French - Canada', 'locale' => 'fr_CA'],
|
||||
['name' => 'Lithuanian', 'locale' => 'lt'],
|
||||
['name' => 'Polish', 'locale' => 'pl'],
|
||||
];
|
||||
|
||||
foreach ($languages as $language) {
|
||||
$record = Language::whereLocale($language['locale'])->first();
|
||||
if ($record) {
|
||||
$record->name = $language['name'];
|
||||
$record->save();
|
||||
} else {
|
||||
Language::create($language);
|
||||
}
|
||||
}
|
||||
|
||||
Eloquent::reguard();
|
||||
}
|
||||
}
|
@ -19,5 +19,6 @@ class UpdateSeeder extends Seeder
|
||||
$this->call('DateFormatsSeeder');
|
||||
$this->call('InvoiceDesignsSeeder');
|
||||
$this->call('PaymentTermsSeeder');
|
||||
$this->call('LanguageSeeder');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user