20220819021223_add_menu_customer_setting.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. use app\model\Permission;
  5. class AddMenuCustomerSetting extends Migrator
  6. {
  7. /**
  8. * Change Method.
  9. *
  10. * Write your reversible migrations using this method.
  11. *
  12. * More information on writing migrations is available here:
  13. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  14. *
  15. * The following commands can be used in this method and Phinx will
  16. * automatically reverse them when rolling back:
  17. *
  18. * createTable
  19. * renameTable
  20. * addColumn
  21. * renameColumn
  22. * addIndex
  23. * addForeignKey
  24. *
  25. * Remember to call "create()" or "update()" and NOT "save()" when working
  26. * with the Table class.
  27. */
  28. public function change()
  29. {
  30. //预览权限
  31. $per = ',material/preview_casedetail';
  32. $w[] = ['id', '=', 2];
  33. $info = Permission::where($w)->find();
  34. $per = $info->relation . $per;
  35. $info->relation = $per;
  36. $info->save();
  37. $per1 = ',video/preview_read';
  38. $w1[] = ['id', '=', 5];
  39. $info1 = Permission::where($w1)->find();
  40. $per1 = $info1->relation . $per1;
  41. $info1->relation = $per1;
  42. $info1->save();
  43. $per2 = ',article/preview_read';
  44. $w2[] = ['id', '=', 6];
  45. $info2 = Permission::where($w2)->find();
  46. $per2 = $info2->relation . $per2;
  47. $info2->relation = $per2;
  48. $info2->save();
  49. $per3 = ',companyStrength/preview_read';
  50. $w3[] = ['auth_name', '=', '公司实力'];
  51. $info3 = Permission::where($w3)->find();
  52. $per3 = $info3->relation . $per3;
  53. $info3->relation = $per3;
  54. $info3->save();
  55. $per4 = ',material/preview_read';
  56. $w4[] = ['id', '=', 5];
  57. $info4 = Permission::where($w4)->find();
  58. $per4 = $info4->relation . $per4;
  59. $info4->relation = $per4;
  60. $info4->save();
  61. //添加菜单客户设置
  62. }
  63. }