12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- use app\model\Permission;
- class AddMenuCustomerSetting extends Migrator
- {
- /**
- * Change Method.
- *
- * Write your reversible migrations using this method.
- *
- * More information on writing migrations is available here:
- * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
- *
- * The following commands can be used in this method and Phinx will
- * automatically reverse them when rolling back:
- *
- * createTable
- * renameTable
- * addColumn
- * renameColumn
- * addIndex
- * addForeignKey
- *
- * Remember to call "create()" or "update()" and NOT "save()" when working
- * with the Table class.
- */
- public function change()
- {
- //预览权限
- $per = ',material/preview_casedetail';
- $w[] = ['id', '=', 2];
- $info = Permission::where($w)->find();
- $per = $info->relation . $per;
- $info->relation = $per;
- $info->save();
- $per1 = ',video/preview_read';
- $w1[] = ['id', '=', 5];
- $info1 = Permission::where($w1)->find();
- $per1 = $info1->relation . $per1;
- $info1->relation = $per1;
- $info1->save();
- $per2 = ',article/preview_read';
- $w2[] = ['id', '=', 6];
- $info2 = Permission::where($w2)->find();
- $per2 = $info2->relation . $per2;
- $info2->relation = $per2;
- $info2->save();
- $per3 = ',companyStrength/preview_read';
- $w3[] = ['auth_name', '=', '公司实力'];
- $info3 = Permission::where($w3)->find();
- $per3 = $info3->relation . $per3;
- $info3->relation = $per3;
- $info3->save();
- $per4 = ',material/preview_read';
- $w4[] = ['id', '=', 5];
- $info4 = Permission::where($w4)->find();
- $per4 = $info4->relation . $per4;
- $info4->relation = $per4;
- $info4->save();
- //添加菜单客户设置
- }
- }
|