table('customer_package') ->addColumn('root_id', 'integer', ['comment' => '所属企业']) ->addColumn('name', 'string', ['comment' => '产品名', 'limit' => 50]) ->addColumn('total_price', 'integer', ['comment' => '总价']) ->create(); // 添加产品管理权限 $p = Permission::where(['uri' => 'customerSetting/index'])->find(); $relation = array_merge(explode(',', $p->relation), ['customerSetting/package', 'customerSetting/editPackage', 'customerSetting/delPackage']); $p->relation = implode(',', $relation); $p->save(); } }