예제 #1
0
 /**
  * View: Video Index
  * @return Respanse
  */
 public function getVideoIndex()
 {
     $articles = Article::orderBy('created_at', 'desc')->where('post_status', 'open')->paginate(6);
     $travel = Travel::orderBy('created_at', 'desc')->where('post_status', 'open')->paginate(4);
     $product = Product::orderBy('created_at', 'desc')->where('post_status', 'open')->where('quantity', '>', '0')->paginate(12);
     $productCategories = ProductCategories::orderBy('sort_order')->where('cat_status', 'open')->get();
     $job = Job::orderBy('created_at', 'desc')->where('post_status', 'open')->paginate(4);
     $categories = Category::orderBy('sort_order')->where('cat_status', 'open')->get();
     if (Auth::check()) {
         $timeline = Timeline::orderBy('created_at', 'desc')->where('user_id', Auth::user()->id)->paginate(6);
     } else {
         $timeline = Timeline::orderBy('created_at', 'desc');
     }
     return View::make('home.videoindex')->with(compact('articles', 'categories', 'travel', 'product', 'productCategories', 'job', 'timeline'));
 }
 /**
  * Resource show view
  * @param  string $slug Slug
  * @return response
  */
 public function show($slug)
 {
     $product = $this->model->where('slug', $slug)->first();
     is_null($product) and App::abort(404);
     $categories = ProductCategories::orderBy('sort_order')->get();
     if (Auth::check()) {
         $inCart = ShoppingCart::where('buyer_id', Auth::user()->id)->where('product_id', $product->id)->first();
     } else {
         $inCart = false;
     }
     return View::make('product.show')->with(compact('product', 'categories', 'inCart'));
 }