requestRepository = $requestRepository; } /** * @return json */ public function sendFriendRequest(StoreFriendRequest $request) { $response = []; try{ $response = $this->requestRepository->sendFriendRequest($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $response['success'] = Constant::STATUS_FALSE; $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * @return json */ public function acceptFriendRequest(UpdateFriendRequest $request) { $response = []; try{ $response = $this->requestRepository->acceptFriendRequest($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $response['success'] = Constant::STATUS_FALSE; $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * @return json */ public function listFriendRequest() { $response = []; try{ $response = $this->requestRepository->listFriendRequest(); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $response['success'] = Constant::STATUS_FALSE; $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * @return json */ public function myListFriendRequest(Request $request) { $response = []; try{ $response = $this->requestRepository->myListFriendRequest($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $response['success'] = Constant::STATUS_FALSE; $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * @return json */ public function sentRequestList() { $response = []; try{ $response = $this->requestRepository->sentRequestList(); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $response['success'] = Constant::STATUS_FALSE; $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * @return json */ public function mySentRequestList(Request $request) { $response = []; try{ $response = $this->requestRepository->mySentRequestList($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $response['success'] = Constant::STATUS_FALSE; $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * @return json */ public function friendList(Request $request) { $response = []; try{ $response = $this->requestRepository->friendList($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $response['success'] = Constant::STATUS_FALSE; $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * @return json */ public function myFriendList(Request $request) { $response = []; try{ $response = $this->requestRepository->myFriendList($request->all()); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $response['success'] = Constant::STATUS_FALSE; $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * @return json */ public function userFriendList(Request $request, User $user) { $response = []; try{ $response = $this->requestRepository->userFriendList($request, $user); $this->setStatusCode($response['status']); } catch (\Exception $ex) { $response['message'] = $ex->getMessage(); $response['success'] = Constant::STATUS_FALSE; $this->setStatusCode(Constant::CODE_403); } return $this->respond($response); } /** * Get suuggestion sant. * @return \Illuminate\Http\Response */ public function friendSuggestion(Request $request) { try { $response = $this->requestRepository->friendSuggestion($request->all()); $this->updateStatusCode($response); return $this->respond($response); } catch (\Exception $ex) { Log::error($ex); return $this->respondInternalError(trans('api.something_went_wrong')); } } }