/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $prereq = PreReq::find($id); $prereq->fecha = Carbon::parse($prereq->fecha)->format('d/m/Y'); $articulos = PreReqArticulo::wherePreReqId($id)->get(); $data['prereq'] = $prereq; if (isset($articulos)) { $data['articulos'] = $articulos; } else { $data['articulos'] = array(); } return view('prereqs.infoPreRequisicion')->with($data); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $articulo = PreReqArticulo::findOrFail($id); $prereq_id = $articulo->prereq->id; $articulo->delete(); return redirect()->action('PreReqController@show', array($prereq_id)); }