12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class AddGroupToPromission 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()
- {
- $this->table('permission')
- ->insert([
- ['id' => 101, 'pid' => 0, 'auth_name' => '集团管理', 'uri' => 'company/brand', 'is_menu' => 1, 'icon' => 'layui-icon layui-icon-set-sm', 'sort' => 50, 'relation' => ''],
- ['id' => 102, 'pid' => 101, 'auth_name' => '店面管理', 'uri' => 'company/shop', 'is_menu' => 0, 'icon' => '', 'sort' => 50, 'relation' => 'company/addshop,company/editshop'],
- ['id' => 103, 'pid' => 101, 'auth_name' => '品牌管理', 'uri' => 'company/brand', 'is_menu' => 0, 'icon' => '', 'sort' => 50, 'relation' => 'company/addbrand,company/editbrand']
- ])->save();
- $this->table('grant')
- ->insert([
- ['id'=>2, 'name'=>'集团管理员','permission'=>'[101,102,103]', 'root_id'=>0]
- ])->save();
- }
- }
|