| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace app\migrations;
- use common\models\backend\Menu;
- use yii\db\Migration;
- /**
- * Class M230713150123InsertQimallMenu
- */
- class M230713150123InsertQimallMenu extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $data = [
- [
- 'cate_id' => '2',// 类型[1=平台,2=商城]
- 'pid' => '38',
- 'title' => '协议设置',
- 'route' => 'mall/service-agreement/index',
- 'icon' => '',
- 'authItemChild' => [// 子菜单权限,此参数若为空则表示无需增加子菜单权限)
- [
- 'title' => '添加/编辑协议',
- 'name' => 'mall/service-agreement/edit',
- ],
- [
- 'title' => '删除协议',
- 'name' => 'mall/service-agreement/del',
- ],
- ]
- ]
- ];
- $res = Menu::migrateCreateMenu($data);
- if ($res === false) throw new \Exception(Menu::getStaticError());
- }catch (\Exception $e){
- \Yii::error('迁移错误:' . $e->getMessage());
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230713150123InsertQimallMenu cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230713150123InsertQimallMenu cannot be reverted.\n";
- return false;
- }
- */
- }
|