| @@ 48-61 (lines=14) @@ | ||
| 45 | * |
|
| 46 | * @return \Illuminate\View\View |
|
| 47 | */ |
|
| 48 | public function postSubscribe() |
|
| 49 | { |
|
| 50 | try { |
|
| 51 | $this->dispatch(new SubscribeSubscriberCommand(Binput::get('email'))); |
|
| 52 | } catch (ValidationException $e) { |
|
| 53 | return Redirect::route('subscribe.subscribe') |
|
| 54 | ->withInput(Binput::all()) |
|
| 55 | ->withTitle(sprintf('<strong>%s</strong> %s', trans('dashboard.notifications.whoops'), trans('gitamin.subscriber.email.failure'))) |
|
| 56 | ->withErrors($e->getMessageBag()); |
|
| 57 | } |
|
| 58 | ||
| 59 | return Redirect::route('explore') |
|
| 60 | ->withSuccess(sprintf('<strong>%s</strong> %s', trans('dashboard.notifications.awesome'), trans('gitamin.subscriber.email.subscribed'))); |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * Handle the verify subscriber email. |
|
| @@ 56-69 (lines=14) @@ | ||
| 53 | * |
|
| 54 | * @return \Illuminate\Http\RedirectResponse |
|
| 55 | */ |
|
| 56 | public function createSubscriberAction() |
|
| 57 | { |
|
| 58 | try { |
|
| 59 | $this->dispatch(new SubscribeSubscriberCommand(Binput::get('email'))); |
|
| 60 | } catch (ValidationException $e) { |
|
| 61 | return Redirect::route('dashboard.subscribers.add') |
|
| 62 | ->withInput(Binput::all()) |
|
| 63 | ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.subscribers.add.failure'))) |
|
| 64 | ->withErrors($e->getMessageBag()); |
|
| 65 | } |
|
| 66 | ||
| 67 | return Redirect::route('dashboard.subscribers.add') |
|
| 68 | ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.subscribers.add.success'))); |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * Deletes a subscriber. |
|