AdminRouterSeeder.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. namespace Database\Seeders\Backend;
  3. use Database\Seeders\BaseSeeder;
  4. use Illuminate\Support\Str;
  5. use Txj\Elastic\Facades\Eav;
  6. class AdminRouterSeeder extends BaseSeeder
  7. {
  8. public function getColumnData()
  9. {
  10. return [
  11. 'group_id' => ['type' => 'uBigint', 'title' => '分组Id'],
  12. 'parent_id' => ['type' => 'uBigint', 'title' => '父级分类'],
  13. 'level' => ['type' => 'integer', 'title' => '分类等级'],
  14. 'type' => ['type' => 'tinyint', 'title' => '类型', 'remark' => '1 菜单 2 目录 3 功能'],
  15. 'title' => ['type' => 'string_60', 'title' => '路由名称'],
  16. 'router_path' => ['type' => 'string_60', 'title' => '路径'],
  17. 'file_path' => ['type' => 'string', 'title' => '文件路径'],
  18. 'is_redirect' => ['type' => 'tinyint', 'title' => '是否重定向'],
  19. 'redirect_name' => ['type' => 'string_60', 'title' => '重定向路由'],
  20. 'icon' => ['type' => 'string_60', 'title' => '图标'],
  21. ];
  22. }
  23. public function init()
  24. {
  25. Eav::table($this->schema)->insert(
  26. [
  27. [
  28. 'mid' => Str::random(12),
  29. 'group_id' => 1,
  30. 'parent_id' => 0,
  31. 'level' => 1,
  32. 'type' => 1,
  33. 'title' => '系统设置',
  34. 'router_path' => '/sys',
  35. 'file_path' => '',
  36. 'is_redirect' => 1,
  37. 'redirect_name' => 'web-router',
  38. 'created_at' => time(),
  39. 'updated_at' => time()
  40. ],
  41. [
  42. 'mid' => Str::random(12),
  43. 'group_id' => 1,
  44. 'parent_id' => 1,
  45. 'level' => 2,
  46. 'type' => 1,
  47. 'title' => '管理员',
  48. 'router_path' => 'admin',
  49. 'file_path' => 'system/manager/index.vue',
  50. 'is_redirect' => 0,
  51. 'redirect_name' => '',
  52. 'created_at' => time(),
  53. 'updated_at' => time()
  54. ],
  55. [
  56. 'mid' => Str::random(12),
  57. 'group_id' => 1,
  58. 'parent_id' => 1,
  59. 'level' => 2,
  60. 'type' => 1,
  61. 'title' => '角色管理',
  62. 'router_path' => 'admin-role',
  63. 'file_path' => 'system/role/index.vue',
  64. 'is_redirect' => 0,
  65. 'redirect_name' => '',
  66. 'created_at' => time(),
  67. 'updated_at' => time()
  68. ],
  69. [
  70. 'mid' => Str::random(12),
  71. 'group_id' => 1,
  72. 'parent_id' => 1,
  73. 'level' => 2,
  74. 'type' => 1,
  75. 'title' => '路由设置',
  76. 'router_path' => 'web-router',
  77. 'file_path' => 'system/router/index.vue',
  78. 'is_redirect' => 0,
  79. 'redirect_name' => '',
  80. 'created_at' => time(),
  81. 'updated_at' => time()
  82. ],
  83. //
  84. [
  85. 'mid' => Str::random(12),
  86. 'group_id' => 1,
  87. 'parent_id' => 0,
  88. 'level' => 1,
  89. 'type' => 1,
  90. 'title' => '内容管理',
  91. 'router_path' => 'con',
  92. 'file_path' => '',
  93. 'is_redirect' => 0,
  94. 'redirect_name' => 'news-list',
  95. 'created_at' => time(),
  96. 'updated_at' => time()
  97. ],
  98. [
  99. 'mid' => Str::random(12),
  100. 'group_id' => 1,
  101. 'parent_id' => 5,
  102. 'level' => 2,
  103. 'type' => 1,
  104. 'title' => '资讯列表',
  105. 'router_path' => 'news-list',
  106. 'file_path' => 'news/list.vue',
  107. 'is_redirect' => 0,
  108. 'redirect_name' => '',
  109. 'created_at' => time(),
  110. 'updated_at' => time()
  111. ],
  112. [
  113. 'mid' => Str::random(12),
  114. 'group_id' => 1,
  115. 'parent_id' => 5,
  116. 'level' => 2,
  117. 'type' => 1,
  118. 'title' => '资讯分类',
  119. 'router_path' => 'news-category',
  120. 'file_path' => 'news/category.vue',
  121. 'is_redirect' => 0,
  122. 'redirect_name' => '',
  123. 'created_at' => time(),
  124. 'updated_at' => time()
  125. ],
  126. [
  127. 'mid' => Str::random(12),
  128. 'group_id' => 1,
  129. 'parent_id' => 5,
  130. 'level' => 2,
  131. 'type' => 1,
  132. 'title' => '广告列表',
  133. 'router_path' => 'position-list',
  134. 'file_path' => 'position/list.vue',
  135. 'is_redirect' => 0,
  136. 'redirect_name' => '',
  137. 'created_at' => time(),
  138. 'updated_at' => time()
  139. ],
  140. [
  141. 'mid' => Str::random(12),
  142. 'group_id' => 1,
  143. 'parent_id' => 5,
  144. 'level' => 2,
  145. 'type' => 1,
  146. 'title' => '广告分类',
  147. 'router_path' => 'position-group',
  148. 'file_path' => 'position/group.vue',
  149. 'is_redirect' => 0,
  150. 'redirect_name' => '',
  151. 'created_at' => time(),
  152. 'updated_at' => time()
  153. ],
  154. [
  155. 'mid' => Str::random(12),
  156. 'group_id' => 1,
  157. 'parent_id' => 5,
  158. 'level' => 2,
  159. 'type' => 1,
  160. 'title' => '文件管理',
  161. 'router_path' => 'media',
  162. 'file_path' => 'media/index.vue',
  163. 'is_redirect' => 0,
  164. 'redirect_name' => '',
  165. 'created_at' => time(),
  166. 'updated_at' => time()
  167. ],
  168. ]
  169. );
  170. }
  171. /**
  172. * Run the database seeds.
  173. *
  174. * @return void
  175. */
  176. public function run()
  177. {
  178. $this->schema = 'web_router';
  179. $this->title = '路由管理表';
  180. // $this->category_type = 2;
  181. $this->start();
  182. }
  183. }