Example #1
0
 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();
 }
Example #2
0
 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');
 }
Example #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     if (!Entrust::can('category-delete')) {
         $this->data['category'] = Category::getNested();
         return view('backend.category.lists', $this->data);
     }
     $category = Category::find($id);
     if ($category->delete()) {
         $category->where('parent', $id)->update(['parent' => 0]);
         $this->data['category'] = Category::getNested();
         return view('backend.category.lists', $this->data);
     }
 }
Example #4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     if (!Entrust::can('product-update')) {
         return redirect('');
     }
     $this->data['sub_title'] = 'Edit Product';
     $this->data['product'] = Product::find($id);
     $this->data['category'] = Category::where('status', 1)->lists('name', 'id');
     return view('backend.product.edit', $this->data);
 }