#12 #16 settings service and timezone/currency setting

This commit is contained in:
Nabeel Shahzad
2017-06-20 15:03:51 -05:00
parent 85610aeec6
commit 7d92c68870
8 changed files with 766 additions and 603 deletions

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Config;
class CreateSettingsTable extends Migration
{
public function __construct()
{
$this->tablename = Config::get('settings.table');
$this->keyColumn = Config::get('settings.keyColumn');
$this->valueColumn = Config::get('settings.valueColumn');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create($this->tablename, function(Blueprint $table)
{
$table->increments('id');
$table->string($this->keyColumn)->index();
$table->text($this->valueColumn);
});
Setting::set('timezone', '0');
Setting::set('currency', 'dollar');
Setting::save();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop($this->tablename);
}
}