示例#1
0
 public function cart($slug, News $news, Request $request)
 {
     $this->data['records'] = $news->getBySlug($slug);
     $id_data = $news->getBySlug($slug);
     $id_news_comment = $id_data->id;
     //Ід новини
     $this->data['newsComments'] = $news->newsComments($id_news_comment);
     $this->data['newsCommentsCount'] = $news->newsCommentsCount($id_news_comment);
     \DB::table('news')->WHERE('id', '=', $id_news_comment)->increment('count_views_news');
     // рахуємо кулькість переглядів новини
     if ($request->ajax()) {
         return response()->json(view('news.ajaxPaginate.Cart', $this->data)->render());
     }
     return view('news.cart', $this->data);
 }