/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // $order = Order::find($id); $order_detail = Order_detail::where('order_id', $id)->get(); $product = Product::all(); $color = Color::all(); $size = Size::all(); return view('backend.pages.order.detail', array('order' => $order, 'detail' => $order_detail, 'product' => $product, 'color' => $color, 'size' => $size)); }
public static function search($type, $size, $maxPrice, $minPrice, $colors) { if ($colors == null) { $colors = Color::all(); foreach ($colors as $key => $color) { $colors[$key] = $color->id; } } if ($colors != null && $type == null && $size == null) { return Product::where('price', '>=', $minPrice)->where('price', '<=', $maxPrice)->whereHas('colors', function ($query) use($colors) { $query->whereIn('id', $colors); })->get(); } if ($type == null) { return Product::where('size', $size)->where('price', '>=', $minPrice)->where('price', '<=', $maxPrice)->whereHas('colors', function ($query) use($colors) { $query->whereIn('id', $colors); })->get(); } if ($size == null) { return Product::where('FK_type', $type)->where('price', '>=', $minPrice)->where('price', '<=', $maxPrice)->whereHas('colors', function ($query) use($colors) { $query->whereIn('id', $colors); })->get(); } return Product::where('size', $size)->where('FK_type', $type)->where('price', '>=', $minPrice)->where('price', '<=', $maxPrice)->whereHas('colors', function ($query) use($colors) { $query->whereIn('id', $colors); })->get(); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index($id = null) { if ($id == null) { $color = Color::all(); } else { $color = Color::find($id); } return $color; }
public function edit($id) { $product = Product::find($id); $colors = Color::all(); $types = Type::all(); $selectedColors = $product->colors; $selectedType = $product->FK_type; foreach ($selectedColors as $color) { $arSelectedColors[] = $color->id; } return view('clothes.edit')->withProduct($product)->withTypes($types)->withColors($colors)->with('selectedColors', $arSelectedColors)->with('selectedType', $selectedType); }
public function editar($id) { $header = 'Editar Producto'; $breadcrumb = 'Editar Producto'; $accion = 'Guardar'; $producto = Producto::where('codigo', $id)->first(); $grupo = Grupo::where('codigo', $producto->marca_id)->first(); $padreGrupo = Grupo::where('id', $grupo->tipo)->first(); $hijos = Grupo::where('tipo', $padreGrupo->id)->get(); $padres = Grupo::where('tipo', 1)->get(); $colores = Color::all(); return view('productos.edit', compact('header', 'breadcrumb', 'padres', 'padreGrupo', 'hijos', 'producto', 'accion', 'colores')); }
/** * Bootstrap any application services. * * @return void */ public function boot() { view()->composer('*', function ($view) { $maxPrice = Product::orderBy('price', 'DESC')->first()->price; $minPrice = Product::orderBy('price', 'ASC')->first()->price; $colors = Color::all(); $types = Type::all(); $heartBag = User::getHeartBag(); if (Auth::check()) { $view->with('bagContent', Auth::user()->bags->where('inBag', 1))->with('colors', $colors)->with('types', $types)->with('maxPrice', $maxPrice)->with('minPrice', $minPrice)->with('heartBag', $heartBag); } else { $view->with('bagContent', 0)->with('heartBag', 0)->with('minPrice', $minPrice)->with('maxPrice', $maxPrice)->with('colors', $colors)->with('types', $types); } }); }
/** * Select all of the possible colors and return their information. * * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response */ public function index() { $colors = Color::all(); return response(['colors' => $colors]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($slug, $id) { $list_color = Product::find($id)->color; $list_size = Product::find($id)->size; $size = Size::all(); $color = Color::all(); $products = Product::with(['category' => function ($querry) { $querry->addSelect('id', 'cate_name'); }, 'brand' => function ($query) { $query->addSelect(['id', 'brand_name']); }, 'image' => function ($q) { $q->addSelect('product_id', 'image_name'); }])->where('slug', $slug)->get(); foreach ($products as $product) { return view('admin.product.edit', compact('product', 'list_color', 'list_size', 'size', 'color')); } }
public function index() { $colores = Color::all(); return response()->json($colores); }
public function index() { // show all $records = Color::all(); return $records; }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // $colors = Color::all(); return view('catalogs.colors.index')->with('colors', $colors); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // $cat_id = new category(); $category = $cat_id->all(); $color = Color::all(); $size = Size::all(); $product = Product::find($id); return view('backend.pages.product.edit2', array('category' => $category, 'product' => $product, 'color' => $color, 'size' => $size)); }
public function getCart() { $colors = Color::all(); $sizes = Size::all(); $nav = new category(); $menu_top = $nav->menu_top($nav->all()->toArray()); $product = new Product(); $all = $product->getall()->take(5); return view('frontend.pages.cart', array('colors' => $colors, 'sizes' => $sizes, 'menu_top' => $menu_top, 'all' => $all)); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $colors = Color::all()->toArray(); return view('admin.color.index', compact('colors')); }