phpvms/database/migrations/2015_08_25_172600_create_settings_table.php

47 lines
1.1 KiB
PHP
Raw Normal View History

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Config;
class CreateSettingsTable extends Migration
{
2017-06-21 11:48:16 +08:00
public function __construct()
{
$this->tablename = Config::get('settings.table');
$this->keyColumn = Config::get('settings.keyColumn');
$this->valueColumn = Config::get('settings.valueColumn');
2017-06-21 11:48:16 +08:00
}
2017-06-21 11:48:16 +08:00
/**
* 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);
$table->timestamps();
2017-06-21 11:48:16 +08:00
});
2017-06-21 11:48:16 +08:00
#Setting::set('currency', 'dollar');
#Setting::set('currency_descrip', 'Currency to use');
2017-06-21 11:48:16 +08:00
#Setting::save();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop($this->tablename);
}
}