/** * Unsubscribe from a LaSalleCRM email list * * @param $token */ public function unsubscribe($token) { // Does the token exist in the list_unsubscribe_token database table? if (!$this->model->isTokenValid($token)) { return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.token_invalid', ['title' => 'Invalid Unsubscribe Token']); } $emailID = $this->model->getEmailIdByToken($token); $listID = $this->model->getListIdByToken($token); // email address $email = $this->emailRepository->getEmailByEmailId($emailID); // list's name $listName = $this->listRepository->getListnameByListId($listID); // Delete all list_unsubscribe_token records for this email_id and list_id $this->model->deleteAllTokensForListIDandEmailID($listID, $emailID); // un-enabled (ie, disable) the list_email database record for this email_id and list_id $this->list_EmailRepository->enabledFalse($emailID, $listID); return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.unsubscribe_success', ['title' => 'Unsubscribe Successful', 'email' => $email, 'listName' => $listName]); }
/** * Create a new record in the "list_email" db table * * @param array $data The data to be saved, which is already validated, washed, & prepped. * @return mixed The new emails.id when save is successful, false when save fails */ public function createNewList_emailRecord($data) { return $this->list_EmailRepository->createNewRecord($data); }