table('company')->addColumn('channel_setting', 'text', ['comment'=>'网销渠道配置', 'default'=>'', 'null'=>true])->update(); $p = Permission::where([['auth_name', '=', 'CRM客户管理']])->find(); $pn = Permission::create([ 'pid' => $p->id, 'auth_name' => '网销渠道设置', 'uri' => 'crm/channel_index', 'relation' => 'crm/channel_index,crm/channel_edit,crm/synchronize_fish_data', 'is_menu' => 1 ]); $grant = Grant::where(['type'=>'m'])->select(); foreach($grant as $g){ $permission = json_decode(json_encode($g->permission), true); $permission[] = $pn->id; $g->permission = $permission; $g->save(); } } }