예제 #1
0
 /**
  * Show the form for editing the specified resource.
  * GET /compras/{id}/edit
  *
  * @param  int  $id
  * @return Response
  */
 public function getEdit($id = NULL)
 {
     if (isset($id)) {
         $compra = Compras::select('compra.igv', 'compra.subtotal', 'compra.total', 'compra.id', 'compra.provedor_id', 'compra.tipocomprobante_id', 'compra.fecha', 'compra.created_at', 'compra.updated_at', 'compra.usuario_id', 'compra.serie', 'compra.numero', 'persona.razonsocial')->where('compra.id', '=', $id)->leftjoin('persona', 'persona.id', '=', 'compra.provedor_id')->first();
         $productos = $compra->productos;
         $tiposdecomprobante = Tipodecomprobante::all()->lists('nombre', 'id');
         return View::make('compras.edit', compact('compra', 'productos', 'tiposdecomprobante'));
     } else {
         return Redirect::to('compras');
     }
 }