public function thumbnail() { $products = Product::all()->toArray(); $allProduct = array(); foreach ($products['data'] as $product) { $allProduct[] = $product; } foreach ($allProduct as $item) { $images = Images::where('productID', $item->id)->first(); $thumbnail = $images['imageSrc']; $model = new Product(); $model->thumbnail = $thumbnail; $model->save(); } }
public function getMyPurchase($id) { $title = "Factura"; $fac = Facturas::find($id); $user = User::find($fac->user_id); $aux = FacturaItem::where('factura_id', '=', $id)->get(array('item_id', 'item_qty')); $i = 0; foreach ($aux as $a) { $b = Items::find($a->item_id); $b->qty = $a->item_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++; } return View::make('user.factura')->with('fact', $item)->with('title', $title)->with('user', $user)->with('factura', $fac); }
private function _editPhotoDes($albumID, $photoID, $content) { $ret = Images::where('album_id', $albumID)->where('id', $photoID)->update(['description' => $content]); return $ret; }
public function getShowItem($id) { $art = Items::where('item.id', '=', $id)->first(array('item.*')); $a = new stdClass(); $a->id = $art->id; $a->item_nomb = $art->item_nomb; $a->item_desc = $art->item_desc; $a->item_cod = $art->item_cod; $a->item_precio = $art->item_precio; if (!is_null($art->percent)) { $a->percent = $art->percent; } $a->misc = array(); $a->tallas = array(); $a->colores = array(); //$misc = Misc::where('item_id','=',$art->id)->first(); $misc = Misc::where('item_id', '=', $art->id)->get(); $aux = array(); $i = 0; foreach ($misc as $m) { $aux[$i] = Images::where('misc_id', '=', $m->id)->where('deleted', '=', 0)->get(); $i++; } $a->images = $aux; $t = Misc::where('item_id', '=', $art->id)->groupBy('item_talla')->get(array('item_talla')); $c = Misc::where('item_id', '=', $art->id)->get(array('item_color', 'item_talla')); $a->tallas = $t; $a->colores = $c; $tallas = Tallas::get(); $colores = Colores::get(); $title = $art->item_nomb; if (Auth::check() && Auth::user()->role == 1) { $layout = 'admin'; } else { $layout = 'default'; } $option = array(); $tallas = Tallas::get(); $colores = Colores::get(); return View::make('indexs.artSelf')->with('title', $title)->with('art', $a)->with('layout', $layout)->with('tallas', $tallas)->with('colores', $colores); }
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 getNewImgPos($id) { $title = "Cambiar posición de las imagenes"; $item = Items::find($id); $misc = Misc::where('item_id', '=', $item->id)->get(array('id')); $images = array(); $j = 0; foreach ($misc as $m) { $x = Images::where('misc_id', '=', $m->id)->where('deleted', '=', 0)->get(array('id', 'misc_id', 'image', 'order')); foreach ($x as $y) { $aux = new stdClass(); $aux->id = $y->id; $aux->misc_id = $y->misc_id; $aux->image = $y->image; $aux->order = $y->order; $images[$j] = $aux; $j++; } } for ($i = 0; $i < count($images); $i++) { for ($j = 0; $j < count($images) - 1; $j++) { if ($images[$j]->order > $images[$j + 1]->order) { $bub = new stdClass(); $bub = $images[$j + 1]; $images[$j + 1] = $images[$j]; $images[$j] = $bub; } } } return View::make('admin.changeImagePos')->with('title', $title)->with('item', $images); }
public function getEditImage($id) { $image = Images::where('id', '=', $id)->with('favorite', 'user')->get(); return View::make('admin/editimage/index')->with('image', $image); }