/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $judge = Judge::findOrFail($id); $licences = JudgeLicence::get(); if (empty($licences)) { return redirect()->route('judge_licences.index')->with('message', 'Najpierw dodaj licencje.'); } return view('judges.edit', compact('judge'))->with('licences', $licences); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $judge_licence = JudgeLicence::findOrFail($id); $judge = Judge::where('LICENCJA_SEDZIEGO_ID_LIC_S', $id)->first(); if (!empty($judge)) { $text = 'Nie mozna usunac - posiada przypisanego sedziego (' . $judge->IMIE . ' ' . $judge->NAZWISKO . ')'; return redirect()->route('judge_licences.index')->with('message', $text); } $judge_licence->delete(); return redirect()->route('judge_licences.index')->with('message', 'Item deleted successfully.'); }