Skip to content

Commit

Permalink
feat(Core): 填充增加默认标签和标签分类
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Nov 9, 2018
1 parent 83fe0fd commit f6353b9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions database/seeds/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function run()
$this->call(PackagesSeeder::class); // Packages seeder.
$this->call(CurrencyTypeSeeder::class); // 默认的货币类型
$this->call(CommonConfigSeeder::class); // 默认用户组
$this->call(TagsTableSeeder::class); // 标签和标签分类
// 把地区放在最后,因为耗时较长.
$this->call(AreasTableSeeder::class);
}
Expand Down
31 changes: 31 additions & 0 deletions database/seeds/TagsTableSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Zhiyi\Plus\Models\Tag;
use Illuminate\Database\Seeder;
use Zhiyi\Plus\Models\TagCategory;

class TagsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$category = $this->createTagCategory();
$tag = new Tag();
$tag->name = '默认标签';
$tag->tag_category_id = $category->id;
$tag->save();
}

protected function createTagCategory()
{
$category = new TagCategory();
$category->name = '默认分类';
$category->save();

return $category;
}
}

0 comments on commit f6353b9

Please sign in to comment.