Cleanup for settings table and moved some seed data into the migrations
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
<?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);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
#Setting::set('currency', 'dollar');
|
||||
#Setting::set('currency_descrip', 'Currency to use');
|
||||
|
||||
#Setting::save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop($this->tablename);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
@@ -81,7 +81,21 @@ class CreateUsersTable extends Migration
|
||||
});
|
||||
|
||||
# create a default user/role
|
||||
$roles = [
|
||||
[
|
||||
'id' => 1,
|
||||
'name' => 'admin',
|
||||
'display_name' => 'Administrators',
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'name' => 'user',
|
||||
'display_name' => 'Pilot'
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
$this->addData('roles', $roles);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateSettingsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('settings', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('order')->default(1);
|
||||
$table->string('name')->default('');
|
||||
$table->string('key');
|
||||
$table->string('value');
|
||||
$table->string('group')->default('general');
|
||||
$table->text('type')->default('text');
|
||||
$table->text('options')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique('key');
|
||||
});
|
||||
|
||||
/**
|
||||
* Initial default settings
|
||||
*/
|
||||
$settings = [
|
||||
[
|
||||
'order' => 1,
|
||||
'name' => 'Start Date',
|
||||
'group' => '',
|
||||
'key' => 'general.start_date',
|
||||
'value' => '',
|
||||
'type' => 'date',
|
||||
'description' => 'The date your VA started',
|
||||
],
|
||||
[
|
||||
'order' => 2,
|
||||
'name' => 'Currency to Use',
|
||||
'group' => 'general',
|
||||
'key' => 'general.currency',
|
||||
'value' => 'dollar',
|
||||
'type' => 'text',
|
||||
'options' => 'dollar,euro,gbp,yen,jpy,rupee,ruble',
|
||||
'description' => 'Currency to show in the interface',
|
||||
],
|
||||
[
|
||||
'order' => 10,
|
||||
'name' => 'Flights from Current',
|
||||
'group' => 'flights',
|
||||
'key' => 'flights.only_flights_from_current',
|
||||
'value' => 'true',
|
||||
'type' => 'boolean',
|
||||
'description' => 'Only allow flights from current location',
|
||||
],
|
||||
[
|
||||
'order' => 20,
|
||||
'name' => 'Hide Inactive Pilots',
|
||||
'group' => 'pilots',
|
||||
'key' => 'pilots.hide_inactive',
|
||||
'value' => 'true',
|
||||
'type' => 'boolean',
|
||||
'description' => 'Don\'t show inactive pilots in the public view',
|
||||
],
|
||||
];
|
||||
|
||||
$this->addData('settings', $settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop($this->tablename);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,4 @@
|
||||
#
|
||||
roles:
|
||||
- id: 1
|
||||
name: admin
|
||||
display_name: Administrators
|
||||
- id: 2
|
||||
name: user
|
||||
display_name: Pilot
|
||||
|
||||
users:
|
||||
- id: 1
|
||||
name: Admin User
|
||||
|
||||
@@ -3,14 +3,6 @@
|
||||
# want to modify or erase any of this here
|
||||
#
|
||||
|
||||
roles:
|
||||
- id: 1
|
||||
name: admin
|
||||
display_name: Administrators
|
||||
- id: 2
|
||||
name: user
|
||||
display_name: Pilot
|
||||
|
||||
ranks:
|
||||
- id: 1
|
||||
name: New Pilot
|
||||
|
||||
Reference in New Issue
Block a user