public static function getPostsByPlaceId($place_id) { if (isset($place_id)) { $lists = UserPosts::where('place_id', $place_id)->get(); } return $lists; }
public static function getBoardById($board_id) { $result["board"] = Board::where('board_id', $board_id)->first(); $result["posts"] = UserPosts::where('board_id', $board_id)->get(); $result["board"]["cover_link"] = $result["posts"][0]["photo_link"]; $result["profile"]["number_of_posts"] = Post::where('board_id', $board_id)->count(); $result["profile"]["number_of_following"] = FollowEvent::countFollower($board_id); return $result; }
public static function getPostByUserId($user_id) { if (isset($user_id)) { return UserPosts::where('user_id', $user_id)->get(); } }