catchAdmin/catch/permissions/database/seeds/DepartmentsSeed.php
JaguarJack 2e81eb42d3
update catch/permissions/database/seeds/DepartmentsSeed.php.
Signed-off-by: JaguarJack <njphper@gmail.com>
2024-01-08 00:36:16 +00:00

40 lines
892 B
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(): void
{
$data = [
[
'id' => 1,
'department_name' => '总部',
'parent_id' => 0,
],
[
'id' => 2,
'department_name' => '北京总部',
'parent_id' => 1,
],
[
'id' => 3,
'department_name' => '南京总部',
'parent_id' => 1,
],
];
foreach ($data as $item) {
\catchAdmin\permissions\model\Department::create($item);
}
}
}