generated from liutk/owl-admin-base
81 lines
3.7 KiB
PHP
81 lines
3.7 KiB
PHP
<?php
|
||
|
||
namespace Database\Seeders;
|
||
|
||
use App\Models\Keyword;
|
||
use Illuminate\Database\Seeder;
|
||
use Illuminate\Support\Arr;
|
||
|
||
class KeywordSeeder extends Seeder
|
||
{
|
||
/**
|
||
* Run the database seeds.
|
||
*
|
||
* @return void
|
||
*/
|
||
public function run()
|
||
{
|
||
Keyword::truncate();
|
||
$list = [
|
||
// ['key' => 'article_category', 'name' => '文章分类', 'list' => []],
|
||
//标签value填写色号,指定标签颜色
|
||
['key' => 'article_tag', 'name' => '文章标签', 'list' => []],
|
||
['key' => 'banner_address', 'name' => '广告位置', 'list' => []],
|
||
['key' => 'institution_type', 'name' => '组织属性', 'list' => [
|
||
'网络化结构组织','道角村综治中心','群防群治组织','党组织','村组织'
|
||
]],
|
||
['key' => 'marry_state', 'name' => '婚姻状况', 'list' => [
|
||
'未婚','已婚','离异','再婚','复婚','丧偶'
|
||
]],
|
||
['key' => 'military_service_status', 'name' => '兵役情况', 'list' => [
|
||
'未服兵役','现役军人','退役军人'
|
||
]],
|
||
['key' => 'person_tag', 'name' => '人口标签', 'list' => [
|
||
'刑满释放人员', '社区矫正人员', '肇事肇祸等严重精神障碍患者', '吸毒人员', '重点青少年','上访信访人员', '艾滋病危险人员','残疾人','低保五保','失独家庭','失业农民','其他困难人员','困难家庭','党员'
|
||
]],
|
||
|
||
//菜单
|
||
['key' => 'financial_cate', 'name' => '财务报表类型', 'list' => []],
|
||
['key' => 'file_cate', 'name' => '档案类型', 'list' => []],
|
||
['key' => 'department', 'name' => '部门管理', 'list' => []],
|
||
['key' => 'area_cate', 'name' => '地区类型', 'list' => []],
|
||
['key' => 'organized_body', 'name' => '社别管理', 'list' => []],
|
||
['key' => 'housing_estate', 'name' => '小区管理', 'list' => []],
|
||
['key' => 'domicile', 'name' => '户籍管理', 'list' => []],
|
||
['key' => 'nation', 'name' => '民族管理', 'list' => []],
|
||
['key' => 'political_face', 'name' => '政治面貌', 'list' => []],
|
||
['key' => 'educational_level', 'name' => '文化程度', 'list' => []],
|
||
['key' => 'oral_disputes', 'name' => '口头纠纷类型', 'list' => []],
|
||
['key' => 'sanitary_inspection', 'name' => '卫生检查类型', 'list' => []],
|
||
['key' => 'book_cate', 'name' => '图书类型', 'list' => []],
|
||
['key' => 'business_area', 'name' => '企业地区管理', 'list' => []],
|
||
['key' => 'money_cate', 'name' => '收支类型', 'list' => []],
|
||
['key' => 'welfare_cate', 'name' => '福利类型', 'list' => []],
|
||
['key' => 'job_cate', 'name' => '工种管理', 'list' => []],
|
||
];
|
||
|
||
foreach ($list as $item) {
|
||
$type = Keyword::create(Arr::except($item, 'list'));
|
||
|
||
if (isset($item['list'])) {
|
||
$keywords = [];
|
||
foreach ($item['list'] as $index => $name) {
|
||
$template = [
|
||
'key' => $type->key . ($index + 1),
|
||
'parent_key' => $type->key,
|
||
'lv' => $type->lv + 1,
|
||
'sort' => $index + 1
|
||
];
|
||
if (is_array($name)) {
|
||
$template = array_merge($template, $name);
|
||
} else {
|
||
$template['name'] = $name;
|
||
}
|
||
array_push($keywords, $template);
|
||
}
|
||
$type->children()->createMany($keywords);
|
||
}
|
||
}
|
||
}
|
||
}
|