'luban/setting'])->find(); if ($np == null) { $p = Permission::where([['auth_name', '=', '企业管理']])->find(); $np = Permission::create([ 'pid' => $p->id, 'auth_name' => '外呼设置', 'uri' => 'luban/setting', 'relation' => 'luban/setting,luban/settingSave', 'is_menu' => 1 ]); } // 复制超级管理员权限 $s = Grant::find(1); $pm = (array)$s->permission; $pm[] = $np->id; $c = [1023,2214]; // 标注为鲁班id foreach ($c as $root_id) { $g = Grant::create([ 'name' => '超级管理员', 'permission' => $pm, 'type' => 'm', 'root_id' => $root_id ]); Employee::where(['root_id' => $root_id, 'top_one' => 1])->update([ 'grant_id' => $g->id ]); } } }