/**
  * Remove an list from the specified resource.
  *
  * @param Request $request
  * @param int $id
  * @return Response
  */
 public function dissociateList(Request $request, $id)
 {
     $this->authorize('EDIT_MAILINGLISTS');
     $subscriber = Subscriber::findOrFail($id);
     $subscriber->dissociateList($request->input('list'));
     $this->notify('mailing_lists.dissociated', 'dissociated_list_from_subscriber', $subscriber);
     return redirect()->route('reactor.subscribers.lists', $id);
 }
Beispiel #2
0
 /**
  * Subscribes an email to a list
  * (depending on the list type)
  *
  * @param string email
  * @param string $list
  */
 public function subscribeMemberTo($email, $list)
 {
     $subscriber = Subscriber::firstOrCreate(compact('email'));
     $list = MailingList::findOrFail($list);
     if ($this->isMemberSubscribedTo($subscriber, $list)) {
         return;
     }
     $list->subscribers()->attach($subscriber);
     if ($list->type === 'mailchimp') {
         $this->subscribeToMailchimpList($subscriber, $list);
     }
 }
 /**
  * @param Request $request
  * @param Subscriber $subscriber
  */
 protected function validateEditForm(Request $request, Subscriber $subscriber)
 {
     $this->validateForm('Reactor\\Html\\Forms\\Subscribers\\CreateEditForm', $request, ['email' => 'required|email|max:255|unique:subscribers,email,' . $subscriber->getKey()]);
 }