Merge branch 'settings' into dev

This commit is contained in:
Michal Kváček
2016-03-14 00:53:48 +01:00
22 changed files with 484 additions and 31 deletions
@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\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->integer('id', true);
$table->string('key', 64)
->unique()
->comment('User readable key for accessing value of this config. Config will be available under this key also in views.');
$table->text('value')
->comment('Value of config.');
$table->boolean('load_into_views')
->default(true)
->comment('Use in views directly?')
->index();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('settings');
}
}
+1
View File
@@ -15,5 +15,6 @@ class DatabaseSeeder extends Seeder
$this->call(SeedCustomFieldTypes::class);
$this->call(SeedCustomFieldResources::class);
$this->call(SeedActionLogTypes::class);
$this->call(SeedSettings::class);
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Seeder;
class SeedSettings extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$types = [
['key' => 'pageName', 'value' => ''],
['key' => 'author', 'value' => ''],
['key' => 'metaKeywords', 'value' => ''],
['key' => 'metaDescription', 'value' => ''],
['key' => 'googleAnalyticsCode', 'value' => ''],
];
foreach ($types as $type) {
\DB::table('settings')
->insert($type);
}
}
}