'超级管理员']; const PERMISSIONS = [ [ 'name' => 'system_ctrl', 'title' => '系统设置', 'path' => '#', 'icon' => 'ios-settings', 'type' => 0, 'open' => 3, 'children' => [ [ 'name' => 'permissions', 'title' => '权限管理', 'path' => '/permissions', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'permissions.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'permissions.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'permissions.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], [ 'name' => 'roles', 'title' => '角色管理', 'path' => '/roles', 'icon' => 'ios-appstore', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'roles.show', 'title' => '查看', 'description' => 'show', 'type' => 1], ['name' => 'roles.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'roles.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'roles.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ['name' => 'roles.sync_permissions', 'title' => '分配权限', 'description' => 'jurisdiction', 'type' => 1], ], ], [ 'name' => 'accounts', 'title' => '账号管理', 'path' => '/accounts', 'icon' => 'ios-browsers', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'accounts.show', 'title' => '查看', 'description' => 'show', 'type' => 1], ['name' => 'accounts.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'accounts.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'accounts.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], [ 'name' => 'logs', 'title' => '日志管理', 'path' => '/logs', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'logs.show','title' => '查看','description' => 'show','type' => 1], ['name' => 'logs.destroy','title' => '删除','description' => 'destroy','type' => 1], ], ], ], ], [ 'name' => 'virtual_company_ctrl', 'title' => '企业设置', 'path' => '#', 'icon' => 'ios-settings', 'type' => 0, 'open' => 3, 'children' => [ [ 'name' => 'virtual.companies.index', 'title' => '企业管理', 'path' => '/companies', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'virtual.companies.show', 'title' => '查看', 'description' => 'show', 'type' => 1], ['name' => 'virtual.companies.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'virtual.companies.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'virtual.companies.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], [ 'name' => 'virtual.company.accounts.index', 'title' => '账号管理', 'path' => '/company/accounts', 'icon' => 'ios-browsers', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'virtual.company.accounts.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'virtual.company.accounts.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'virtual.company.accounts.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], [ 'name' => 'virtual.products.index', 'title' => '定价管理', 'path' => '/logs', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'virtual.products.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'virtual.products.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'virtual.products.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], ], ], [ 'name' => 'virtual_package_ctrl', 'title' => '套餐设置', 'path' => '#', 'icon' => 'ios-settings', 'type' => 0, 'open' => 3, 'children' => [ [ 'name' => 'virtual.packages.index', 'title' => '基础套餐', 'path' => '/packages?type=0', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'virtual.packages.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'virtual.packages.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'virtual.packages.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], ], ], [ 'name' => 'virtual_order_ctrl', 'title' => '订单管理', 'path' => '#', 'icon' => 'ios-settings', 'type' => 0, 'open' => 3, 'children' => [ [ 'name' => 'virtual.orders.index', 'title' => '销售订单', 'path' => '/orders?type=0', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'virtual.orders.show', 'title' => '查看', 'description' => 'show', 'type' => 1], ['name' => 'virtual.orders.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'virtual.orders.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'virtual.orders.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], ], ], ]; /** * Run the database seeds. * * @return void */ public function run() { if (DB::table('roles')->count() || DB::table('permissions')->count()) { return ; } app(RoleRepository::class)->create(self::ROLES); foreach (self::PERMISSIONS as $permissions) { app(PermissionRepository::class)->create($permissions); } $rootRole = app(RoleRepository::class)->where('name', '超级管理员')->first(); $permissions = app(PermissionService::class)->getPermissions(); $rootRole->syncPermissions($permissions); Account::where('username', 'root')->first()->assignRole($rootRole); } }