Exemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $allNews = News::where('active', '=', '1')->orderBy('published_at', 'DESC')->paginate(5);
     $countOfComments = Comments::select('comment_id')->where('comments.active', '=', '1')->groupBy('comment_id')->count('comment_id');
     return view('news', ['allNews' => $allNews, 'countOfComments' => $countOfComments]);
 }