public static function getPostsByFollowingUserId($user_id) { if (isset($user_id)) { $list_id = FollowEvent::where('follower_id', $user_id)->get(['following_id']); return UserPosts::whereIn('user_id', $list_id)->get(); } }
public static function getPosts($post_id) { $photo_id = Post::where('post_id', $post_id)->get(['photo_link'])[0]["photo_link"]; $list_id = PostRecommendView::where("photo_id", $photo_id)->orderBy("rank", "desc")->take(10)->get(["post_id_recommend"]); $results = UserPosts::whereIn("post_id", $list_id)->distinct('photo_link')->get(); return $results; }
public static function getPosts($post_id) { $list_id = PostRecommend::where("post_id", $post_id)->orderBy("rank", "desc")->take(10)->get(["post_id_recommend"]); $results = UserPosts::whereIn("post_id", $list_id)->get(); return $results; }