public function checkFollow(Request $request) { $data = $request->data; $data['user_id'] = $this->user_id; $image_user_id = ImageServiceFacade::findIdUserOfImage($data['image_id']); if ((int) $image_user_id == (int) $this->user_id) { return response()->json(['follow' => "duplicate id"]); } $result = FollowServiceFacade::checkFollow($data); if ($result) { return response()->json(['follow' => "following"]); } return response()->json(['follow' => "follow"]); }