RolesSeed.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CatchAdmin [Just Like ~ ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
  8. // +----------------------------------------------------------------------
  9. // | Author: JaguarJack [ njphper@gmail.com ]
  10. // +----------------------------------------------------------------------
  11. use think\migration\Seeder;
  12. class RolesSeed extends Seeder
  13. {
  14. /**
  15. * Run Method.
  16. *
  17. * Write your database seeder using this method.
  18. *
  19. * More information on writing seeders is available here:
  20. * http://docs.phinx.org/en/latest/seeding.html
  21. */
  22. public function run()
  23. {
  24. \catchAdmin\permissions\model\Roles::create([
  25. 'role_name' => '超级管理员',
  26. 'identify' => 'admin',
  27. 'description' => 'super user',
  28. 'data_range' => 1,
  29. 'creator_id' => 1,
  30. 'id' => 1,
  31. ]);
  32. \think\facade\Db::name( 'user_has_roles')->insert([
  33. 'role_id' => 1,
  34. 'uid' => 1,
  35. ]);
  36. \catchAdmin\permissions\model\Roles::create([
  37. 'role_name' => '一级管理员',
  38. 'identify' => 'manage',
  39. 'description' => 'manage',
  40. 'data_range' => 1,
  41. 'creator_id' => 1,
  42. 'id' => 2,
  43. ]);
  44. }
  45. }