コード例 #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($post_id)
 {
     //
     $post = $this->getPostDetail($post_id)[0];
     $post_stat = $this->getPostDetail($post_id)[1];
     if (Auth::check()) {
         $post["liked"] = LikeEvent::checkLiked($post["post_id"], Auth::user()->user_id);
     }
     $post["comments"] = Post::getCommentsByPostId($post_id);
     $post["likes"] = $post_stat["likes"];
     $post["pins"] = $post_stat["pins"];
     $post["boards"] = Board::getPostsInBoard($post["board_id"]);
     $post["places"] = Place::getPlaceById(Post::getPostById($post_id)['place_id']);
     $recommend = new RecommendController();
     $post["recommend_posts"] = $recommend->getPost($post_id);
     return response()->json($post);
 }