Example #1
0
 public function getDisplayFeed(Request $request, $FeedID)
 {
     $user_id = \Auth::user()->id;
     # Get any articles which have been marked as read
     $readArticles = \p4\UserArticle::where('user_id', $user_id)->where('marked_as_read', 1)->pluck('article_id');
     $article_count = \p4\Article::where('feed_id', $FeedID)->count();
     # Retrieve articles for this feed and leave out the items which have been marked as read by the user
     $articles = \p4\Article::where('feed_id', $FeedID)->whereNotIn('id', $readArticles)->orderby('publish_date', 'DESC')->paginate(env('PAGE_SIZE', 50));
     $feed_name = \p4\UserFeed::where('feed_id', $FeedID)->where('user_id', $user_id)->first()->feed_name;
     return view('articles', ['title' => "News Stories from " . $feed_name . " (" . $article_count . " articles)", 'articles' => $articles, 'user_id' => $user_id]);
 }