public function __construct() { $this->data['categories'] = Products\Category::where('status', '!=', 0)->GetNested(); $this->data['products'] = Products\Product::where('product_status', '!=', 0)->take(shopOpt('product_perpage_front'))->get(); $this->data['mtop'] = Page\Page::where('page_status', 1)->where('page_position', '=', 'top')->GetNested('top'); $this->data['mbottom'] = Page\Page::where('page_status', 1)->where('page_position', '=', 'bottom')->GetNested('bottom'); $this->data['slideshow'] = Widget\Slideshow::where('ss_status', 1)->orderBy('ss_order')->get(); }
public function show($slug) { // $findcat = Products\Category::with('product')->where('slug', $slug)->first(); if (count($findcat) == 0) { $findpro = Products\Product::where('slug', $slug)->first(); $this->data['product'] = $findpro; $this->data['related_product'] = Products\Product::where('id_category', $findpro->id_category)->where('id', '!=', $findpro->id)->get(); if (count($findpro) > 0) { return view('front.eshopper.pages.product', $this->data); } } else { $this->data['products'] = $findcat->product()->paginate(5); return view('front.eshopper.pages.category', $this->data); } $this->data['page'] = Page\Page::where('page_slug', $slug)->first(); if (count($this->data['page'])) { return view('front.eshopper.pages.pages', $this->data); } return abort('404', 'Page Not Found'); }