get(); $res = []; foreach($role as $v){ $roles = Role::where('name', '=', $v['role_name'])->get(); foreach($roles as $vv){ $res[$vv['child']] = $vv['child']; } } $res = array_unique($res); return view('admin/index',['res'=>$res]); } }