AdminRouterGroupSeeder.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace Database\Seeders\Backend;
  3. use Database\Seeders\BaseSeeder;
  4. use Illuminate\Support\Str;
  5. use Txj\Elastic\Facades\Eav;
  6. /**
  7. * 动态路由,控制前端路由
  8. */
  9. class AdminRouterGroupSeeder extends BaseSeeder
  10. {
  11. public function getColumnData()
  12. {
  13. return [
  14. 'title' => ['type' => 'string_60', 'title' => '分组标题'],
  15. 'name' => ['type' => 'string_60', 'title' => '分组标识'],
  16. 'icon' => ['type' => 'string_60', 'title' => '图标'],
  17. 'status' => ['type' => 'tinyint', 'title' => '状态', 'remark' => '1 启用 其他不启用'],
  18. ];
  19. }
  20. public function init()
  21. {
  22. Eav::table($this->schema)->insert(
  23. [
  24. [
  25. 'mid' => Str::random(12),
  26. 'title' => '默认',
  27. 'name' => 'home',
  28. 'status' => 1,
  29. 'created_at' => time(),
  30. 'updated_at' => time()
  31. ],
  32. ]
  33. );
  34. }
  35. /**
  36. * Run the database seeds.
  37. *
  38. * @return void
  39. */
  40. public function run()
  41. {
  42. $this->schema = 'web_router_group';
  43. $this->title = '路由分组表';
  44. // $this->category_type = 2;
  45. $this->start();
  46. }
  47. }