Exemple #1
0
 /**
  * @return array
  */
 public function answer($answerId)
 {
     try {
         $answer = $this->answersRepository->find($answerId);
     } catch (ModelNotFoundException $e) {
         return $this->respondNotFound("No answer found with an id={$answerId}");
     }
     return $this->respond(['data' => $this->answersTransformer->transform($answer->toArray())]);
 }
 /**
  * Unsubscribe an answerer from one or more lists.
  *
  * @param       $answer_id
  * @param array $allLists
  */
 public function unSubscribeAnswerer($answer_id, array $allLists = [])
 {
     // Update database record
     $this->answers->unSubscribeAnswererFromResults($answer_id);
     // Find the email for the answer, and unsubscribe it to the list
     $email = $this->answers->find($answer_id)->email;
     foreach ($allLists as $list) {
         $this->newsletter->unSubscribeFrom($list, $email);
     }
 }