Merge pull request #2193 from jitendra-webkul/1.0

Issue #1988 fixed
This commit is contained in:
Jitendra Singh 2020-01-29 12:53:02 +05:30 committed by GitHub
commit 62060fcbea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 9969 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

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

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