Introduce new Setting model. Set the site name.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('settings', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->text('value')->nullable()->default(null);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('settings');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ class DatabaseSeeder extends Seeder {
|
||||
{
|
||||
Eloquent::unguard();
|
||||
|
||||
// $this->call('UserTableSeeder');
|
||||
$this->call('SettingsTableSeeder');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
class SettingsTableSeeder extends Seeder {
|
||||
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Eloquent::unguard();
|
||||
|
||||
$defaultSettings = [
|
||||
[
|
||||
"name" => "site_name",
|
||||
"value" => "Test"
|
||||
]
|
||||
];
|
||||
|
||||
Setting::truncate();
|
||||
|
||||
foreach($defaultSettings as $setting) {
|
||||
Setting::create($setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user