Exemplo n.º 1
0
 /**
  * Unsubscribe an answerer from a list.
  *
  * @param null $fromWhat
  *
  * @return \Illuminate\View\View
  *
  * @throws Exception
  */
 public function unSubscribeAnswerer($fromWhat = null)
 {
     extract(Input::all());
     // We need a field with answer id, otherwise throw an exception
     if (!isset($answer_id)) {
         throw new Exception('Missing Answer Id');
     }
     try {
         // Check that the list is valid
         $this->newsletter->checkListExists($fromWhat);
         // Subscribe
         $this->subscriptionService->unSubscribeAnswerer($answer_id, [$fromWhat]);
     } catch (Exception $e) {
         return view('errors.generic', ['message' => $e->getMessage()]);
     }
     return view('survey.unsubscribed', compact('answer_id'));
 }