/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { try { $permissao_role = array(); $regras = Role::findOrFail($id); $permissoes_role = $regras->permissions->toArray(); foreach ($permissoes_role as $pu) { $permissao_role[] = $pu['pivot']['permission_id']; } return view('role.edit', ['dados' => $regras, 'permissoes' => Permission::all(), 'permissoes_role' => $permissao_role]); } catch (ModelNotFoundException $e) { flash()->error("Desculpe, ocorreu buscar o registro!"); return redirect()->route('regras.create'); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return view('permissoes.index', ['dados' => Permission::all()->except([1, 2]), 'trash' => Permission::onlyTrashed()->get()]); }