'超级管理员']; 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-people', 'type' => 0, 'open' => 3, 'children' => [ [ 'name' => 'virtual.companies.index', 'title' => '企业管理', 'path' => '/companies', 'icon' => 'ios-options', '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' => 'md-person', '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' => '/products', 'icon' => 'md-pizza', '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/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_card_ctrl', 'title' => '客户管理', 'path' => '#', 'icon' => 'ios-settings', 'type' => 0, 'open' => 3, 'children' => [ [ 'name' => 'virtual.cards.index', 'title' => '客户列表', 'path' => '/cards', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'virtual.cards.show', 'title' => '查看', 'description' => 'show', 'type' => 1], ], ], ], ], [ 'name' => 'virtual_order_ctrl', 'title' => '订单管理', 'path' => '#', 'icon' => 'md-infinite', 'type' => 0, 'open' => 3, 'children' => [ [ 'name' => 'virtual.orders.0.index', 'title' => '销售订单', 'path' => '/orders/0', 'icon' => 'ios-bulb', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'virtual.orders.0.show', 'title' => '查看', 'description' => 'show', 'type' => 1], ['name' => 'virtual.orders.0.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'virtual.orders.0.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'virtual.orders.0.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], [ 'name' => 'virtual.orders.1.index', 'title' => '续费订单', 'path' => '/orders/1', 'icon' => 'md-pulse', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'virtual.orders.1.show', 'title' => '查看', 'description' => 'show', 'type' => 1], ['name' => 'virtual.orders.1.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'virtual.orders.1.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'virtual.orders.1.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], [ 'name' => 'virtual.orders.2.index', 'title' => '续费包订单', 'path' => '/orders/2', 'icon' => 'md-basket', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'virtual.orders.2.show', 'title' => '查看', 'description' => 'show', 'type' => 1], ['name' => 'virtual.orders.2.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'virtual.orders.2.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'virtual.orders.2.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], [ 'name' => 'virtual.orders.3.index', 'title' => '加油包订单', 'path' => '/orders/3', 'icon' => 'ios-color-fill', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'virtual.orders.3.show', 'title' => '查看', 'description' => 'show', 'type' => 1], ['name' => 'virtual.orders.3.create', 'title' => '创建', 'description' => 'create', 'type' => 1], ['name' => 'virtual.orders.3.update', 'title' => '编辑', 'description' => 'update', 'type' => 1], ['name' => 'virtual.orders.3.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], ], ], [ 'name' => 'stats_ctrl', 'title' => '数据统计', 'path' => '#', 'icon' => 'md-planet', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'stats.company-index', 'title' => '企业统计', 'path' => '/stats/company-count', 'icon' => 'md-git-merge', 'type' => 0, 'open' => 3], ['name' => 'stats.order.0', 'title' => '销售订单统计', 'path' => '/stats/order/0', 'icon' => 'ios-bulb', 'type' => 0, 'open' => 3], ['name' => 'stats.order.1', 'title' => '续费订单统计', 'path' => '/stats/order/1', 'icon' => 'md-pulse', 'type' => 0, 'open' => 3], ['name' => 'stats.order.2', 'title' => '续费包订单统计', 'path' => '/stats/order/2', 'icon' => 'md-basket', 'type' => 0, 'open' => 3], ['name' => 'stats.order.3', 'title' => '加油包订单统计', 'path' => '/stats/order/3', 'icon' => 'ios-color-fill', 'type' => 0, 'open' => 3], ['name' => 'stats.company-report.1', 'title' => '用户月报表', 'path' => '/stats/company-report/1', 'icon' => 'ios-contacts', 'type' => 0, 'open' => 3], ['name' => 'stats.company-report.2', 'title' => '增值包月报表', 'path' => '/stats/company-report/2', 'icon' => 'md-bonfire', 'type' => 0, 'open' => 3], ], ], [ 'name' => 'export.index', 'title' => '导出记录', 'path' => '/exports', 'icon' => 'ios-download', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'exports.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1], ], ], [ 'name' => 'artisan_ctrl', 'title' => '任务管理', 'path' => '#', 'icon' => 'ios-locate', 'type' => 0, 'open' => 3, 'children' => [ ['name' => 'artisan.real-sync', 'title' => 'RD数据同步', 'path' => '/artisan/real-sync', 'icon' => 'ios-color-filter', 'type' => 0, 'open' => 3], ], ], ]; /** * Run the database seeds. * * @return void */ public function run() { if (!DB::table('roles')->count()) { app(RoleRepository::class)->create(self::ROLES); $rootRole = app(RoleRepository::class)->where('name', '超级管理员')->first(); Account::where('username', 'root')->first()->assignRole($rootRole); } if (!DB::table('permissions')->count()) { 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); } } }