新增seed
This commit is contained in:
parent
dd46a28096
commit
8084e11805
@ -1 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use think\migration\Seeder;
|
||||||
|
|
||||||
|
class DepartmentsSeed extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run Method.
|
||||||
|
*
|
||||||
|
* Write your database seeder using this method.
|
||||||
|
*
|
||||||
|
* More information on writing seeders is available here:
|
||||||
|
* http://docs.phinx.org/en/latest/seeding.html
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
[
|
||||||
|
'id' => 1,
|
||||||
|
'department_name' => '总部',
|
||||||
|
'parent_id' => 0,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 2,
|
||||||
|
'department_name' => '北京总部',
|
||||||
|
'parent_id' => 1,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 2,
|
||||||
|
'department_name' => '南京总部',
|
||||||
|
'parent_id' => 1,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($data as $item) {
|
||||||
|
\catchAdmin\permissions\model\Department::create($item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -71,7 +71,7 @@ class PermissionSeed extends Seeder
|
|||||||
'id' => 2,
|
'id' => 2,
|
||||||
'permission_name' => '主页',
|
'permission_name' => '主页',
|
||||||
'parent_id' => 1,
|
'parent_id' => 1,
|
||||||
'route' => '/dashboard/workplac',
|
'route' => '/dashboard/workplace',
|
||||||
'icon' => '',
|
'icon' => '',
|
||||||
'module' => 'index',
|
'module' => 'index',
|
||||||
'creator_id' => 1,
|
'creator_id' => 1,
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
use think\migration\Seeder;
|
use think\migration\Seeder;
|
||||||
|
|
||||||
class DepartmentsSeed extends Seeder
|
class ConfigSeed extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run Method.
|
* Run Method.
|
||||||
@ -16,24 +16,21 @@ class DepartmentsSeed extends Seeder
|
|||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
[
|
[
|
||||||
'id' => 1,
|
'name' => '基础配置',
|
||||||
'department_name' => '总部',
|
'pid' => 0,
|
||||||
'parent_id' => 0,
|
'component' => 'basic',
|
||||||
|
'key' => 'basic',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => 2,
|
'name' => '上传配置',
|
||||||
'department_name' => '北京总部',
|
'pid' => 0,
|
||||||
'parent_id' => 1,
|
'component' => 'upload',
|
||||||
],
|
'key' => 'upload',
|
||||||
[
|
|
||||||
'id' => 2,
|
|
||||||
'department_name' => '南京总部',
|
|
||||||
'parent_id' => 1,
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($data as $item) {
|
foreach ($data as $item) {
|
||||||
\catchAdmin\permissions\model\Department::create($item);
|
\catchAdmin\system\model\Config::create($item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user