123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- use app\model\Permission;
- use app\model\Grant;
- class AddMenuPrefancementTasks 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()
- {
- $menu = [
- 'pid' => 0,
- 'uri'=>'preformanceTasks/index',
- 'is_menu'=>1,
- 'icon'=>'layui-icon layui-icon-set-sm',
- 'sort'=>50,
- 'relation'=>'preformanceTasks/index,preformanceTasks/orders,preformanceTasks/tasks,preformance_tasks/add,preformanceTasks/add,preformanceTasks/add_data,preformanceTasks/assign,preformanceTasks/get_person,preformanceTasks/get_cid,preformanceTasks/save,preformanceTasks/edit,preformanceTasks/edit_data,preformanceTasks/deposit,preformanceTasks/deposit_list,preformanceTasks/money,preformanceTasks/details,preformanceTasks/details_list,preformanceTasks/statistical,preformanceTasks/statistical_list,dailyTasks/index,dailyTasks/index,dailyTasks/list,dailyTasks/person,dailyTasks/person_list,dailyTasks/del_task,dailyTasks/index,preformanceTasks/del_tasks',
- 'auth_name'=>'任务中心'
- ];
- $id = Permission::insertGetId($menu);
- $info = Grant::where('id',1)->find();
- $pids = (array)$info->permission;
- $pids[] = (int)$id;
- $info->permission = array_values($pids);
- $info->save();
- $info = Grant::where('id',28)->find();
- $pids = (array)$info->permission;
- $pids[] = (int)$id;
- $info->permission = array_values($pids);
- $info->save();
- }
- }
|