Ejemplo n.º 1
0
 public function deactivate($id)
 {
     $colour = Colour::find($id);
     $colour->status = 0;
     $colour->save();
     return redirect('home/colours');
 }
Ejemplo n.º 2
0
 /**
  * Show the form for creating a new Cruiseline.
  *
  * @return View
  */
 public function edit($id)
 {
     $product = Product::find($id);
     $types = Type::where('status', '=', '1')->orderBy('name', 'ASC')->lists('name', 'id');
     $categories = Category::where('status', '=', '1')->orderBy('name', 'ASC')->lists('name', 'id');
     $brochures = Brochure::where('status', '=', '1')->whereHas('label', function ($q) {
         $q->where('name', '=', 'Size Charts');
     })->orderBy('name', 'ASC')->lists('name', 'id');
     $colours = Colour::where('status', '=', '1')->lists('name', 'id');
     return view('products.edit', compact('product', 'types', 'categories', 'brochures', 'colours'));
 }
 public function showLinen($group, $colour)
 {
     $catSlug = 'linen';
     $catName = 'Linen';
     $groupId = Group::where('slug', '=', $group)->first();
     $colourId = Colour::where('slug', '=', $colour)->first();
     $group_id = "%";
     $groupSlug = '0';
     if ($group !== '0') {
         $group_id = $groupId->id;
         $groupSlug = $groupId->slug;
         $groupName = $groupId->name;
     }
     $colour_id = "%";
     $colourSlug = '0';
     $colourHex = '0';
     if ($colour !== '0') {
         $colour_id = $colourId->id;
         $colourSlug = $colourId->slug;
         $colourHex = $colourId->hex;
     }
     //Living nightmare to work out how to get this to order on the collection field.
     //Seems you have to use the function to joing the products anf then run the eager load
     $results = colour::with(['product' => function ($query) {
         $query->select('products.*')->join('groups', 'group_id', '=', 'groups.id')->orderBy('groups.collection', 'ASC');
     }, 'product.group'])->where('id', '=', $colour_id)->paginate(100);
     //return $results;
     $groups = Group::where('cat_id', 'LIKE', 60)->get();
     $colours = Colour::orderby('order')->get();
     $cat = 'linen';
     $cat_id = 60;
     session::put('colour', $colourHex);
     Session::flash('keywords', 'linen, Tablecloths, napkins');
     Session::flash('title', 'Linen');
     //return $results[0];
     return View::make('results', compact('results', 'groups', 'groupSlug', 'colours', 'colourId', 'cat', 'cat_id', 'catSlug', 'groupName', 'catName'));
     //return View::make('results');
 }
Ejemplo n.º 4
0
 public function colours()
 {
     $this->data['colours'] = Colour::where('status', '=', 1)->get();
     $data = $this->data;
     return view('colours', $data);
 }