permission; $pm[] = 198; $c = [1027]; 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 ]); } } }