commit
62060fcbea
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AlterNameColumnInCountryStateTranslationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('country_state_translations', function (Blueprint $table) {
|
||||
$table->renameColumn('name', 'default_name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('country_state_translations', function (Blueprint $table) {
|
||||
$table->renameColumn('default_name', 'name');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Arr;
|
||||
use DB;
|
||||
|
||||
class CountryStateTranslationSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
|
||||
foreach (['ar', 'fa', 'pt_BR'] as $code) {
|
||||
DB::table('country_translations')->where('locale', $code)->delete();
|
||||
|
||||
DB::table('country_state_translations')->where('locale', $code)->delete();
|
||||
|
||||
$countryTranslations = json_decode(file_get_contents(__DIR__ . '/../../Data/country_state_translation/countries_' . $code . '.json'), true);
|
||||
|
||||
data_fill($countryTranslations, '*.locale', $code);
|
||||
|
||||
$stateTranslations = json_decode(file_get_contents(__DIR__ . '/../../Data/country_state_translation/states_' . $code . '.json'), true);
|
||||
|
||||
data_fill($stateTranslations, '*.locale', $code);
|
||||
|
||||
DB::table('country_translations')->insert($countryTranslations);
|
||||
DB::table('country_state_translations')->insert($stateTranslations);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ class DatabaseSeeder extends Seeder
|
|||
$this->call(CurrencyTableSeeder::class);
|
||||
$this->call(CountriesTableSeeder::class);
|
||||
$this->call(StatesTableSeeder::class);
|
||||
$this->call(CountryStateTranslationSeeder::class);
|
||||
$this->call(ChannelTableSeeder::class);
|
||||
$this->call(ConfigTableSeeder::class);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,11 @@ namespace Webkul\Core\Models;
|
|||
use Webkul\Core\Eloquent\TranslatableModel;
|
||||
use Webkul\Core\Contracts\CountryState as CountryStateContract;
|
||||
|
||||
|
||||
class CountryState extends TranslatableModel implements CountryStateContract
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
public $translatedAttributes = ['name'];
|
||||
public $translatedAttributes = ['default_name'];
|
||||
|
||||
protected $with = ['translations'];
|
||||
}
|
||||
|
|
@ -9,5 +9,5 @@ class CountryStateTranslation extends Model implements CountryStateTranslationCo
|
|||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['name'];
|
||||
protected $fillable = ['default_name'];
|
||||
}
|
||||
Loading…
Reference in New Issue