FEATURE: Add language into widgets

This commit is contained in:
Michal Kváček
2016-07-22 15:30:03 +02:00
parent f90aee4108
commit bce98e6eaf
7 changed files with 54 additions and 3 deletions
@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddLanguageIntoWidgets extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('widgets', function (Blueprint $table) {
$table->string('language', 8)
->after('widget_type_handler')
->default(\App::getLocale());
$table->foreign('language')
->references('code')
->on('languages')
->onDelete('cascade')
->onUpdate('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('widgets', function (Blueprint $table) {
$table->dropForeign('widgets_language_foreign');
$table->dropColumn('language');
});
}
}