/** * Show the form for editing the specified resource. * * @param int $id * * @return Response */ public function edit($id) { $authRola = Auth::user()->role_id; $tematypraktyk = TematyPraktyk::findOrFail($id); $specjalizacje = Specjalizacje::all(); return view('tematypraktyk.edit', ['tematypraktyk' => $tematypraktyk, 'specjalizacje' => $specjalizacje]); }
/** * Remove the specified resource from storage. * * @param int $id * * @return Response */ public function destroy($id) { if (Auth::user()->role_id == 1 || Auth::user()->role_id == 3) { try { Specjalizacje::destroy($id); Session::flash('flash_message', 'Skasowano specjalizacje!'); return redirect('specjalizacje'); } catch (\Exception $e) { Session::flash('flash_message', 'Specjalizacja jest używana w deklaracji nie można jej skasować'); return redirect('specjalizacje'); } } else { Session::flash('flash_message', 'Nie masz do tego uprawnień'); return redirect('home'); } }