withPageTitle(trans('dashboard.subscribers.subscribers').' - '.trans('dashboard.dashboard')) ->withSubscribers(Subscriber::all()); } /** * Shows the add subscriber view. * * @return \Illuminate\View\View */ public function showAddSubscriber() { return View::make('dashboard.subscribers.add') ->withPageTitle(trans('dashboard.subscribers.add.title').' - '.trans('dashboard.dashboard')); } /** * Creates a new subscriber. * * @return \Illuminate\Http\RedirectResponse */ public function createSubscriberAction() { try { $this->dispatch(new SubscribeSubscriberCommand(Binput::get('email'))); } catch (ValidationException $e) { return Redirect::route('dashboard.subscribers.add') ->withInput(Binput::all()) ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.subscribers.add.failure'))) ->withErrors($e->getMessageBag()); } return Redirect::route('dashboard.subscribers.add') ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.subscribers.add.success'))); } /** * Deletes a subscriber. * * @param \CachetHQ\Cachet\Models\Subscriber $subscriber * * @throws \Exception * * @return \Illuminate\Http\RedirectResponse */ public function deleteSubscriberAction(Subscriber $subscriber) { $this->dispatch(new UnsubscribeSubscriberCommand($subscriber)); return Redirect::route('dashboard.subscribers.index'); } }