コード例 #1
0
 /**
  * Gets the social media posts for the specified $hashtag.
  *
  * @example array($post1, $post2, $post3)
  * @param  string $term hashtag term to search for
  * @return array|object
  */
 protected function getPosts($term)
 {
     // search social media provider feeds for the specified hashtag term
     $posts = $this->searchHashtag($term);
     // sort posts
     Post::sortPosts($posts, \Session::get('sort_by'));
     // merge posts with current user's saved posts
     $this->mergePosts($posts);
     return $posts;
 }
コード例 #2
0
 /**
  * Gets the current user's saved posts.  Returns an empty Collection if user
  * is not logged in.
  *
  * @example array($post1, $post2, $post3)
  * @return array|object
  */
 protected function getUserPosts()
 {
     // if a user is logged in, then return the user's saved posts
     // otherwise, return an empty array
     $user_posts = \Auth::check() ? \Auth::user()->posts->all() : [];
     // sort user's saved posts
     Post::sortPosts($user_posts, \Session::get('sort_by'));
     return $user_posts;
 }