/** * Creates a new incident template. * * @return \Illuminate\Http\RedirectResponse */ public function createIncidentTemplateAction() { $_template = Binput::get('template'); $template = IncidentTemplate::create($_template); if (!$template->isValid()) { segment_track('Dashboard', ['event' => 'Created Incident Template', 'success' => false]); return Redirect::back()->withInput(Binput::all())->with('title', sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.add.failure')))->with('errors', $template->getErrors()); } segment_track('Dashboard', ['event' => 'Created Incident Template', 'success' => true]); $successMsg = sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.add.success')); return Redirect::back()->with('success', $successMsg); }
/** * Creates a new incident template. * * @return \Illuminate\Http\RedirectResponse */ public function createIncidentTemplateAction() { try { IncidentTemplate::create(Binput::get('template')); } catch (ValidationException $e) { return Redirect::route('dashboard.templates.add')->withInput(Binput::all())->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.incidents.templates.add.failure')))->withErrors($e->getMessageBag()); } return Redirect::route('dashboard.templates.add')->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.add.success'))); }
/** * Creates a new incident template. * * @return \Illuminate\Http\RedirectResponse */ public function createIncidentTemplateAction() { $_template = Binput::get('template'); $template = IncidentTemplate::create($_template); return Redirect::back()->with('template', $template); }