/** * Reply post (Facebook) * * @param Request $request * @param integer $id * * @return view */ public function replyPost(Request $request, $id) { $this->validate($request, ['answer' => 'required']); $publishment = $this->publishment->find($id); if ($request->input('in_reply_to') != "") { $replyTo = $request->input('in_reply_to'); $reply = $this->facebookContent->answerPost($request->input('answer'), $replyTo); $this->insertInnerComment($id, $request, $replyTo, $reply); } else { $replyTo = $publishment->fb_post_id; $reply = $this->facebookContent->answerPost($request->input('answer'), $replyTo); $this->reaction->insertReaction(self::TYPE_FACEBOOK, $reply, $id, $request->input('answer')); } return back(); }
/** * Reply to post on Facebook (either a comment or an inner-comment) * * @param Request $request * @param integer $caseId * * @return \Illuminate\View\View */ public function replyPost(Request $request, $caseId) { $this->validate($request, ['answer' => 'sometimes|required', 'answer_specific' => 'sometimes|required']); $case = $this->case->find($caseId); $this->updateLatestHelper($case); if ($request->input('in_reply_to') != '') { $messageId = $request->input('in_reply_to'); $answer = $request->input('answer_specific'); } else { $messageId = $case->messages->first()->fb_post_id; $answer_to = $case->messages->sortByDesc('id')->first(); $answer = $request->input('answer'); } $reply = $this->facebookContent->answerPost($answer, $messageId); if ($request->input('in_reply_to') != '') { $this->insertInnerComment($request, $messageId, $reply); } else { $this->insertAnswer(self::TYPE_FACEBOOK_POST, $request, $case, $answer_to, $reply, null); } $this->case->openCase($case); return back(); }