This commit is contained in:
Jitendra Singh 2020-01-29 12:51:12 +05:30
parent 2e6d7aff95
commit 0b67488a0b
10 changed files with 9968 additions and 3 deletions

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

View File

@ -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');
});
}
}

View File

@ -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);
}
}
}

View File

@ -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'];
}

View File

@ -9,5 +9,5 @@ class CountryStateTranslation extends Model implements CountryStateTranslationCo
{
public $timestamps = false;
protected $fillable = ['name'];
protected $fillable = ['default_name'];
}