/** * Setup the layout used by the controller. * * @return void */ protected function getItem() { if (Request::ajax()) { $inp = Input::all(); $misc = Misc::where('item_id', '=', $inp['id'])->where('item_talla', '=', $inp['talla'])->where('item_color', '=', $inp['color'])->where('deleted', '=', 0)->first(); $aux = Misc::where('item_id', '=', $inp['id'])->where('deleted', '=', 0)->first(); $img = Images::where('deleted', '!=', 1)->where('misc_id', '=', $aux->id)->first(); $talla = Tallas::find($inp['talla']); $color = Colores::find($inp['color']); Cart::add(array('id' => $inp['id'], 'name' => $inp['name'], 'qty' => 1, 'options' => array('misc' => $misc->id, 'img' => $img->image, 'talla' => $inp['talla'], 'talla_desc' => $talla->talla_desc, 'color' => $inp['color'], 'color_desc' => $color->color_desc), 'price' => $inp['price'])); $rowid = Cart::search(array('id' => $inp['id'], 'options' => array('talla' => $inp['talla'], 'color' => $inp['color']))); $item = Cart::get($rowid[0]); return Response::json(array('rowid' => $rowid[0], 'img' => $img->image, 'id' => $item->id, 'name' => $item->name, 'talla' => $talla->talla_desc, 'color' => $color->color_desc, 'qty' => $item->qty, 'price' => $item->price, 'subtotal' => $item->subtotal, 'cantArt' => Cart::count(), 'total' => Cart::total())); } }
public function postMdfTalla($id) { $inp = Input::all(); $rules = array('name_talla' => 'required', 'desc_talla' => 'required'); $msg = array('required' => 'El campo es obligatorio'); $validator = Validator::make($inp, $rules, $msg); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $talla = Tallas::find($id); $talla->talla_nomb = $inp['name_talla']; $talla->talla_desc = $inp['desc_talla']; if ($talla->save()) { Session::flash('success', 'Talla modificada satisfactoriamente'); return Redirect::to('administrador/inicio'); } else { Session::flash('danger', 'Error al modificar la talla'); return Redirect::back(); } }