/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(Request $r, $id) { $this->validate($r, ['nm_unidade' => 'required|min:3|max:60']); unidade::find($id)->update($r->all()); return redirect('restaurante/lista'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function excluir($id) { try { unidade::destroy($id); return redirect('restaurante/lista'); } catch (\Illuminate\Database\QueryException $e) { return redirect('restaurante/lista')->with('message', 'Unidade não pode ser excluida devido a dependências'); } }