新增数据
This commit is contained in:
parent
9b2ac5fd49
commit
dd46a28096
1
catch/permissions/database/seeds/DepartmentsSeed.php
Normal file
1
catch/permissions/database/seeds/DepartmentsSeed.php
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
39
catch/system/database/seeds/ConfigSeed.php
Normal file
39
catch/system/database/seeds/ConfigSeed.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user