AdminRoleSeeder.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Database\Seeders\Backend;
  3. use Database\Seeders\BaseSeeder;
  4. use Txj\Elastic\Facades\Eav;
  5. class AdminRoleSeeder extends BaseSeeder
  6. {
  7. public function getColumnData()
  8. {
  9. return [
  10. 'name' => ['type' => 'string_60', 'title' => '名称'],
  11. 'status' => ['type' => 'string_60', 'title' => '状态', 'remark' => '1 启用'],
  12. 'remark' => ['type' => 'string', 'title' => '备注'],
  13. 'privileges' => ['type' => 'object', 'title' => '权限', 'is_null' => 1,],
  14. ];
  15. }
  16. public function init()
  17. {
  18. Eav::table($this->schema)->insert([
  19. 'name' => '超级管理员',
  20. 'remark' => '超级管理员,拥有所有权限',
  21. 'status' => 1,
  22. 'privileges' => [],
  23. ]);
  24. }
  25. /**
  26. * Run the database seeds.
  27. *
  28. * @return void
  29. */
  30. public function run()
  31. {
  32. $this->schema = 'admin_role';
  33. $this->title = '管理员角色表';
  34. // $this->category_type = 2;
  35. $this->start();
  36. }
  37. }