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(); }
/** * Execute the command. * * @return void */ public function handle() { $page = Page::where('slug', $this->old_slug)->first(); $page->name = $this->name; $page->slug = $this->slug; $page->content = $this->content; $page->save(); }
/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { parent::boot($router); $router->bind('category', function ($slug) { return Category::where('slug', $slug)->first(); }); $router->bind('post', function ($slug) { return Post::where('slug', $slug)->first(); }); $router->bind('page', function ($slug) { return Page::where('slug', $slug)->first(); }); }
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'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // if (!Entrust::can('page-update')) { return redirect(''); } $this->data['sub_title'] = "Edit " . ucfirst(Request::get('position')) . " Page"; $this->data['position'] = Request::get('position'); $this->data['page'] = Page::find($id); $this->data['parent'] = Page::where('id', '!=', $id)->where('page_position', Request::get('position'))->where('page_parent', '=', 0)->lists('page_name', 'id'); return view('backend.page.edit', $this->data); }
/** * Execute the command. * * @return void */ public function handle() { Page::where('slug', $this->slug)->first()->delete(); }