/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update() { $parametros = Input::get(); $reglas = array('id' => 'required|integer', 'banco' => 'required', 'descripcion' => 'required'); $validator = Validator::make($parametros, $reglas); if (!$validator->fails()) { foreach ($parametros as $key => $value) { if (!array_key_exists($key, $reglas)) { unset($parametros[$key]); } } Bancos::where('id', '=', $parametros['id'])->update($parametros); $res['data'] = Bancos::find($parametros['id']); $respuesta = json_encode(array('error' => false, 'mensaje' => '', 'respuesta' => $res)); } else { $respuesta = json_encode(array('error' => true, 'mensaje' => 'No hay parametros o estan mal.', 'respuesta' => null)); } $final_response = Response::make($respuesta, 200); $final_response->header('Content-Type', "application/json; charset=utf-8"); return $final_response; }
public function getProcesePurchase($id) { $title = "Metodo de pago | Nia Boutique.com"; $fac = Facturas::find($id); $x = FacturaItem::where('factura_id', '=', $id)->sum('item_qty'); $aux = FacturaItem::where('factura_id', '=', $id)->get(array('item_id', 'item_qty', 'item_talla', 'item_color', 'item_precio')); $i = 0; $auxT = 0; $auxQ = 0; $p = ''; foreach ($aux as $a) { $b = Items::where('item.id', '=', $a->item_id)->first(); $p = $p . $b->item_nomb . ', '; $b->qty = $a->item_qty; $b->precio = $a->item_precio; $b->item_talla = Tallas::where('id', '=', $a->item_talla)->pluck('talla_desc'); $b->item_color = Colores::where('id', '=', $a->item_color)->pluck('color_desc'); $auxT = $auxT + $b->qty * $b->item_precio; $auxQ = $auxQ + $b->qty; $aux = Misc::where('item_id', '=', $a->item_id)->where('deleted', '=', 0)->first(); $b->img = Images::where('misc_id', '=', $aux->id)->where('deleted', '=', 0)->first(); $item[$i] = $b; $i++; } $total = 0; $method = 'hola'; $bancos = Bancos::where('deleted', '=', 0)->get(); return View::make('indexs.showCart')->with('title', $title)->with('method', $method)->with('total', $total)->with('items', $item)->with('id', $id)->with('bancos', $bancos); }
public function getEditBank() { $title = "Editar bancos"; $bancos = Bancos::where('deleted', '=', 0)->get(); return View::make('admin.editBanks')->with('title', $title)->with('bancos', $bancos); }