示例#1
0
 public static function getProfile($user_id)
 {
     $number_of_following = FollowEvent::countFollowing($user_id);
     $number_of_follower = FollowEvent::countFollower($user_id);
     $number_of_boards = Board::countBoardsByUserId($user_id);
     $number_of_posts = Post::countPostsByUserId($user_id);
     return array("number_of_posts" => $number_of_posts, "number_of_boards" => $number_of_boards, "number_of_follower" => $number_of_follower, "number_of_following" => $number_of_following);
 }
 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;
 }