20220613141330_add_huoma_to_permission_table.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. use think\migration\Migrator;
  3. use \app\model\Permission;
  4. use \app\model\Grant;
  5. use think\migration\db\Column;
  6. class AddHuomaToPermissionTable extends Migrator
  7. {
  8. /**
  9. * Change Method.
  10. *
  11. * Write your reversible migrations using this method.
  12. *
  13. * More information on writing migrations is available here:
  14. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  15. *
  16. * The following commands can be used in this method and Phinx will
  17. * automatically reverse them when rolling back:
  18. *
  19. * createTable
  20. * renameTable
  21. * addColumn
  22. * renameColumn
  23. * addIndex
  24. * addForeignKey
  25. *
  26. * Remember to call "create()" or "update()" and NOT "save()" when working
  27. * with the Table class.
  28. */
  29. public function change()
  30. {
  31. $parent_id = (new Permission())->where('auth_name', '=', '营销工具')->value('id');
  32. $id = (new Permission())->insertGetId(
  33. ['pid' => $parent_id, 'auth_name' => '渠道活码', 'uri' => 'huoma/code_list', 'is_menu' => 1, 'icon' => null, 'sort' => 50, 'relation' => 'huoma/code_list,huoma/add_code,huoma/add_img,huoma/edit_code,huoma/visit_list,huoma/up_status,huoma/user_list,huoma/add_qrcode,huoma/del_code,huoma/del_qrcode']
  34. );
  35. }
  36. }