Skip to content
This repository has been archived by the owner on May 5, 2019. It is now read-only.

Commit

Permalink
change setting saved way: database
Browse files Browse the repository at this point in the history
  • Loading branch information
forehalo committed Feb 15, 2016
1 parent eae8199 commit 95df340
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 56 deletions.
56 changes: 0 additions & 56 deletions config/blog.php

This file was deleted.

31 changes: 31 additions & 0 deletions database/migrations/2016_02_15_213515_create_settings_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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('key');
$table->string('value');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('setting');
}
}
53 changes: 53 additions & 0 deletions database/seeds/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function run()
$this->call(PostTagTableSeeder::class);
$this->call(CommentTableSeeder::class);
$this->call(LinkTableSeeder::class);
$this->call(SettingTableSeeder::class);
}
}

Expand Down Expand Up @@ -233,4 +234,56 @@ public function run()
'link' => $faker->url
]);
}
}

class SettingTableSeeder extends Seeder
{
public function run()
{
DB::table('settings')->create([
'key' => 'title',
'value' => 'My Blog'
]);
DB::table('settings')->create([
'key' => 'name',
'value' => 'My Name'
]);
DB::table('settings')->create([
'key' => 'card_title',
'value' => 'Card Title'
]);
DB::table('settings')->create([
'key' => 'notice',
'value' => 'Simple description of me'
]);
DB::table('settings')->create([
'key' => 'description',
'value' => 'Blog Description'
]);
DB::table('settings')->create([
'key' => 'url',
'value' => 'localhost'
]);
DB::table('settings')->create([
'key' => 'pagination',
'value' => '5'
]);
DB::table('settings')->create([
'key' => 'hot_tags_count',
'value' => '10'
]);
DB::table('settings')->create([
'key' => 'email',
'value' => '[email protected]'
]);
DB::table('settings')->create([
'key' => 'github',
'value' => 'github.com/forehalo'
]);
DB::table('settings')->create([
'key' => 'weibo',
'value' => 'weibo.com/liuyiAaron'
]);

}
}

0 comments on commit 95df340

Please sign in to comment.