1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- use app\model\Permission;
- use think\migration\Migrator;
- use think\migration\db\Column;
- class ChangeMenus20220714 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()
- {
- $sucai = Permission::where(['auth_name' => '素材中心'])->find();
- $childs = Permission::where(['pid' => $sucai->id])->select();
- $change = [
- 'material/caselisting' => ['auth_name' => '装修案例', 'sort' => 30],
- 'material/evidencelisting' => ['auth_name' => '客户好评', 'sort' => 36],
- 'video/index' => ['auth_name' => '拓客视频', 'sort' => 32],
- 'article/index' => ['auth_name' => '拓客图文', 'sort' => 34],
- 'construction/index' => ['auth_name' => '在施工地', 'sort' => 40],
- 'building/index' => ['auth_name' => '热装楼盘', 'sort' => 38]
- ];
- foreach ($childs as $c) {
- $c->save($change[$c->uri]);
- }
- Permission::where(['uri' => 'article/add'])->update(['auth_name'=>'图文管理']);
- Permission::where(['uri' => 'article/del'])->update(['auth_name'=>'图文删除']);
- Permission::where(['uri' => 'material/evidence_add'])->update(['auth_name'=>'好评管理']);
- Permission::where(['uri' => 'material/apievidelete'])->update(['auth_name'=>'好评删除']);
-
- }
- }
|