Пример #1
1
 /**
  * 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));
 }
Пример #2
0
 public static function addSize($size)
 {
     $data = new Size();
     $data->name = $size;
     $data->save();
     return $data->id;
 }
Пример #3
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $record = Size::with('user')->get();
     if (!$record) {
         return View::make('errors.404');
     }
     //return View::make('company_category.index')->with('data', $record);
     return View::make('size.index', ['data' => $record, 'sizes' => $this->getSizeListAsJson()]);
 }
 public function category($slug)
 {
     $cates = Category::all();
     $c = $cates->where('slug', $slug)->take(1);
     //        dd($c);
     $color = [];
     foreach ($c[0]->product as $p) {
         foreach ($p->color as $colorr) {
             if (!in_array($colorr->code, $color)) {
                 $color[] = $colorr->code;
             }
         }
     }
     $brands = $c[0]->brand;
     $products = Product::where('cate_id', $c[0]->id)->paginate(10);
     $sizes = Size::all();
     return view('frontend.pages.cate', compact('products', 'cates', 'color', 'brands', 'sizes'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $size = Size::findOrFail($id);
     $size->delete();
     return redirect()->route('admin.size.index')->with('alert-success', 'Delete complete');
 }
 /**
  * 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'));
     }
 }
Пример #7
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Size::destroy($id);
 }
Пример #8
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $record = Size::find($id);
     $record->delete();
     Session::flash('message', "Record deleted");
     return Redirect::to('/size');
 }
Пример #9
0
 public function run()
 {
     DB::table('sizes')->delete();
     Size::create(array('title' => '40', 'user_id' => 1));
     Size::create(array('title' => '>100', 'user_id' => 1));
 }
Пример #10
0
 /**
  * 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));
 }
Пример #11
0
 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));
 }