Skip to content

Commit

Permalink
Merge branch 'release/releasing-localization-demo'
Browse files Browse the repository at this point in the history
  • Loading branch information
themodernpk committed Feb 13, 2020
2 parents d144a1c + 8a53462 commit eb68cf5
Show file tree
Hide file tree
Showing 33 changed files with 1,897 additions and 54 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"keywords": ["laravel", "cms"],
"homepage": "https://www.webreinvent.com",
"license": "MIT",
"version": "0.3.5",
"version": "0.3.6",
"authors": [
{
"name": "WebReinvent",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"moment": "^2.24.0",
"nprogress": "^0.2.0",
"popper.js": "^1.14.7",
"vaah-vue-clicktocopy": "^1.0.1",
"vaah-vue-clicktocopy": "^1.1.3",
"vaah-vue-select": "^1.6.0",
"vaahcms-vue-helpers": "0.0.9",
"vue": "^2.6.10",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVhLangLanguagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{

Schema::create('vh_lang_languages', function (Blueprint $table) {
$table->increments('id');

$table->string('name')->nullable();
$table->string('locale_code_iso_639')->nullable();
$table->boolean('right_to_left')->nullable()->default(0);
$table->boolean('default')->nullable()->default(0);
$table->integer('count_strings')->nullable()->default(0);
$table->integer('count_strings_filled')->nullable()->default(0);

$table->integer('created_by')->nullable();
$table->integer('updated_by')->nullable();
$table->integer('deleted_by')->nullable();
$table->timestamps();
$table->softDeletes();

});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('vh_lang_languages');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVhLangCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{

Schema::create('vh_lang_categories', function (Blueprint $table) {
$table->increments('id');

$table->string('name')->nullable();
$table->string('slug')->nullable();
$table->integer('count_strings')->nullable()->default(0);
$table->integer('count_strings_filled')->nullable()->default(0);

$table->integer('created_by')->nullable();
$table->integer('updated_by')->nullable();
$table->integer('deleted_by')->nullable();
$table->timestamps();
$table->softDeletes();

});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('vh_lang_categories');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVhLangStringsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{

Schema::create('vh_lang_strings', function (Blueprint $table) {
$table->increments('id');

$table->integer('vh_lang_language_id')->nullable();
$table->integer('vh_lang_category_id')->nullable();

$table->string('name')->nullable();
$table->string('slug')->nullable();
$table->mediumText('content')->nullable();


$table->integer('created_by')->nullable();
$table->integer('updated_by')->nullable();
$table->integer('deleted_by')->nullable();

$table->timestamps();
$table->softDeletes();


});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('vh_lang_strings');
}
}
67 changes: 67 additions & 0 deletions src/Database/Seeders/VaahCmsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public function run()

$this->seedPermissions();
$this->seedRoles();
$this->seedLanguages();
$this->seedLanguageCategories();

}

Expand Down Expand Up @@ -96,5 +98,70 @@ function seedRoles()
}


/**
* Run the database seeds.
*
* @return void
*/
function seedLanguages()
{

$list = file_get_contents(__DIR__.'/json/languages.json');
$list = json_decode($list, true);


foreach($list as $item)
{
$exist = \DB::table( 'vh_lang_languages' )
->where( 'locale_code_iso_639', $item['locale_code_iso_639'] )
->first();

if (!$exist){

if($item['locale_code_iso_639'] == 'en')
{
$item['default'] = 1;
}

\DB::table( 'vh_lang_languages' )->insert( $item );
}
}

}

/**
* Run the database seeds.
*
* @return void
*/
function seedLanguageCategories()
{
$row_list = [
'General',
];

$list = [];
foreach ($row_list as $row_item)
{
$list[] = [
'name' => $row_item,
'slug' => Str::slug($row_item),
];
}


foreach($list as $item)
{
$exist = \DB::table( 'vh_lang_categories' )
->where( 'slug', $item['slug'] )
->first();

if (!$exist){
\DB::table( 'vh_lang_categories' )->insert( $item );
}
}

}


}
3 changes: 3 additions & 0 deletions src/Database/Seeders/json/languages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
{"name": "English", "locale_code_iso_639": "en", "default": 1}
]
Loading

0 comments on commit eb68cf5

Please sign in to comment.