@@ 69-85 (lines=17) @@ | ||
66 | * |
|
67 | * @return \Illuminate\View\View |
|
68 | */ |
|
69 | public function getVerify($code = null) |
|
70 | { |
|
71 | if ($code === null) { |
|
72 | throw new NotFoundHttpException(); |
|
73 | } |
|
74 | ||
75 | $subscriber = Subscriber::where('verify_code', '=', $code)->first(); |
|
76 | ||
77 | if (! $subscriber || $subscriber->verified()) { |
|
78 | throw new BadRequestHttpException(); |
|
79 | } |
|
80 | ||
81 | $this->dispatch(new VerifySubscriberCommand($subscriber)); |
|
82 | ||
83 | return Redirect::route('explore') |
|
84 | ->withSuccess(sprintf('<strong>%s</strong> %s', trans('dashboard.notifications.awesome'), trans('gitamin.subscriber.email.verified'))); |
|
85 | } |
|
86 | ||
87 | /** |
|
88 | * Handle the unsubscribe. |
|
@@ 94-110 (lines=17) @@ | ||
91 | * |
|
92 | * @return \Illuminate\View\View |
|
93 | */ |
|
94 | public function getUnsubscribe($code = null) |
|
95 | { |
|
96 | if ($code === null) { |
|
97 | throw new NotFoundHttpException(); |
|
98 | } |
|
99 | ||
100 | $subscriber = Subscriber::where('verify_code', '=', $code)->first(); |
|
101 | ||
102 | if (! $subscriber || ! $subscriber->verified()) { |
|
103 | throw new BadRequestHttpException(); |
|
104 | } |
|
105 | ||
106 | $this->dispatch(new UnsubscribeSubscriberCommand($subscriber)); |
|
107 | ||
108 | return Redirect::route('explore') |
|
109 | ->withSuccess(sprintf('<strong>%s</strong> %s', trans('dashboard.notifications.awesome'), trans('gitamin.subscriber.email.unsubscribed'))); |
|
110 | } |
|
111 | } |
|
112 |