public function deleteMail(Request $request) { $input = $request->get('address'); // 해당회원이 가진 이메일을 찾는다. $selected = null; foreach ($this->member->mails as $mail) { if ($mail->address === $input) { $selected = $mail; break; } } // 해당회원이 가진 이메일이 아닐 경우 예외처리한다. if ($selected === null) { $e = new InvalidArgumentException(); $e->setMessage('존재하지 않는 이메일입니다.'); throw $e; } XeDB::beginTransaction(); try { $this->mails->delete($selected); } catch (\Exception $e) { XeDB::rollback(); throw $e; } XeDB::commit(); return Presenter::makeApi(['message' => '삭제되었습니다.']); }
/** * 이메일의 인증여부를 체크한다. * 주어진 이메일 주소가 등록대기 이메일 목록에 있는지 실제 이메일 목록에 있는지 체크한 후 반환한다. * * @param string $email 체크할 이메일 주소 * * @return boolean 이메일 인증 여부 */ public function checkEmailConfirmation($email) { $mail = $this->pendingMails->findByAddress($email); if ($mail !== null) { return false; } $mail = $this->mails->findByAddress($email); if ($mail === null) { throw new NotFoundEmailException(); } return true; }
public function postConfirmMail() { $input = Input::only('id', 'confirm'); $mail = $this->mails->find($input['id']); if ($mail === null) { $e = new InvalidArgumentHttpException(); $e->setMessage('존재하지 않는 이메일입니다.'); throw $e; } $mail->confirmed = array_get($input, 'confirm', 1); $mail = $this->mails->update($mail); return Presenter::makeApi(['mail' => $mail]); }