Fixed redirects with “cachet_redirect” helper
This commit is contained in:
@@ -58,7 +58,7 @@ class AuthController extends Controller
|
||||
if (Auth::user()->hasTwoFactor) {
|
||||
Session::put('2fa_id', Auth::user()->id);
|
||||
|
||||
return cachet_route('auth.two-factor');
|
||||
return cachet_redirect('auth.two-factor');
|
||||
}
|
||||
|
||||
Auth::attempt($loginData, $rememberUser);
|
||||
@@ -68,7 +68,7 @@ class AuthController extends Controller
|
||||
return Redirect::intended(cachet_route('dashboard'));
|
||||
}
|
||||
|
||||
return cachet_route('auth.login')
|
||||
return cachet_redirect('auth.login')
|
||||
->withInput(Binput::except('password'))
|
||||
->withError(trans('forms.login.invalid'));
|
||||
}
|
||||
@@ -113,11 +113,11 @@ class AuthController extends Controller
|
||||
// Failed login, log back out.
|
||||
Auth::logout();
|
||||
|
||||
return cachet_route('auth.login')->withError(trans('forms.login.invalid-token'));
|
||||
return cachet_redirect('auth.login')->withError(trans('forms.login.invalid-token'));
|
||||
}
|
||||
}
|
||||
|
||||
return cachet_route('auth.login')->withError(trans('forms.login.invalid-token'));
|
||||
return cachet_redirect('auth.login')->withError(trans('forms.login.invalid-token'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -137,7 +137,7 @@ class ComponentController extends Controller
|
||||
$componentData['enabled']
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.components.edit', [$component->id])
|
||||
return cachet_redirect('dashboard.components.edit', [$component->id])
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.edit.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
@@ -153,7 +153,7 @@ class ComponentController extends Controller
|
||||
|
||||
$component->tags()->sync($componentTags);
|
||||
|
||||
return cachet_route('dashboard.components.edit', [$component->id])
|
||||
return cachet_redirect('dashboard.components.edit', [$component->id])
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.edit.success')));
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ class ComponentController extends Controller
|
||||
$componentData['enabled']
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.components.create')
|
||||
return cachet_redirect('dashboard.components.create')
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.add.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
@@ -206,7 +206,7 @@ class ComponentController extends Controller
|
||||
|
||||
$component->tags()->sync($componentTags);
|
||||
|
||||
return cachet_route('dashboard.components')
|
||||
return cachet_redirect('dashboard.components')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.add.success')));
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ class ComponentController extends Controller
|
||||
{
|
||||
dispatch(new RemoveComponentCommand($component));
|
||||
|
||||
return cachet_route('dashboard.components')
|
||||
return cachet_redirect('dashboard.components')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.delete.success')));
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ class ComponentController extends Controller
|
||||
{
|
||||
dispatch(new RemoveComponentGroupCommand($group));
|
||||
|
||||
return cachet_route('dashboard.components.groups')
|
||||
return cachet_redirect('dashboard.components.groups')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.delete.success')));
|
||||
}
|
||||
|
||||
@@ -280,13 +280,13 @@ class ComponentController extends Controller
|
||||
Binput::get('visible')
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.components.groups.create')
|
||||
return cachet_redirect('dashboard.components.groups.create')
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.groups.add.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.components.groups')
|
||||
return cachet_redirect('dashboard.components.groups')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.groups.add.success')));
|
||||
}
|
||||
|
||||
@@ -308,13 +308,13 @@ class ComponentController extends Controller
|
||||
Binput::get('visible')
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.components.groups.edit', [$group->id])
|
||||
return cachet_redirect('dashboard.components.groups.edit', [$group->id])
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.groups.edit.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.components.groups.edit', [$group->id])
|
||||
return cachet_redirect('dashboard.components.groups.edit', [$group->id])
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.groups.edit.success')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class DashboardController extends Controller
|
||||
*/
|
||||
public function redirectAdmin()
|
||||
{
|
||||
return cachet_route('dashboard');
|
||||
return cachet_redirect('dashboard');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -138,13 +138,13 @@ class IncidentController extends Controller
|
||||
null
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.incidents.create')
|
||||
return cachet_redirect('dashboard.incidents.create')
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.incidents.add.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.incidents')
|
||||
return cachet_redirect('dashboard.incidents')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.add.success')));
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ class IncidentController extends Controller
|
||||
{
|
||||
$template->delete();
|
||||
|
||||
return cachet_route('dashboard.templates')
|
||||
return cachet_redirect('dashboard.templates')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.delete.success')));
|
||||
}
|
||||
|
||||
@@ -198,13 +198,13 @@ class IncidentController extends Controller
|
||||
try {
|
||||
IncidentTemplate::create(Binput::get('template'));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.templates.create')
|
||||
return cachet_redirect('dashboard.templates.create')
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.incidents.templates.add.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.templates')
|
||||
return cachet_redirect('dashboard.templates')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.add.success')));
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ class IncidentController extends Controller
|
||||
{
|
||||
dispatch(new RemoveIncidentCommand($incident));
|
||||
|
||||
return cachet_route('dashboard.incidents')
|
||||
return cachet_redirect('dashboard.incidents')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.delete.success')));
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ class IncidentController extends Controller
|
||||
null
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.incidents.edit', ['id' => $incident->id])
|
||||
return cachet_redirect('dashboard.incidents.edit', ['id' => $incident->id])
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.incidents.templates.edit.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
@@ -274,7 +274,7 @@ class IncidentController extends Controller
|
||||
$incident->component->update(['status' => Binput::get('component_status')]);
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.incidents.edit', ['id' => $incident->id])
|
||||
return cachet_redirect('dashboard.incidents.edit', ['id' => $incident->id])
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.edit.success')));
|
||||
}
|
||||
|
||||
@@ -290,12 +290,12 @@ class IncidentController extends Controller
|
||||
try {
|
||||
$template->update(Binput::get('template'));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.templates.edit', ['id' => $template->id])
|
||||
return cachet_redirect('dashboard.templates.edit', ['id' => $template->id])
|
||||
->withUpdatedTemplate($template)
|
||||
->withTemplateErrors($e->getMessageBag()->getErrors());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.templates.edit', ['id' => $template->id])
|
||||
return cachet_redirect('dashboard.templates.edit', ['id' => $template->id])
|
||||
->withUpdatedTemplate($template);
|
||||
}
|
||||
|
||||
@@ -328,13 +328,13 @@ class IncidentController extends Controller
|
||||
$this->auth->user()
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.incidents.update', ['id' => $incident->id])
|
||||
return cachet_redirect('dashboard.incidents.update', ['id' => $incident->id])
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.incidents.templates.edit.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.incidents')
|
||||
return cachet_redirect('dashboard.incidents')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.delete.success')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,13 +82,13 @@ class MetricController extends Controller
|
||||
$metricData['threshold']
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.metrics.create')
|
||||
return cachet_redirect('dashboard.metrics.create')
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.metrics.add.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.metrics')
|
||||
return cachet_redirect('dashboard.metrics')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.add.success')));
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ class MetricController extends Controller
|
||||
{
|
||||
dispatch(new RemoveMetricCommand($metric));
|
||||
|
||||
return cachet_route('dashboard.metrics')
|
||||
return cachet_redirect('dashboard.metrics')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.delete.success')));
|
||||
}
|
||||
|
||||
@@ -155,13 +155,13 @@ class MetricController extends Controller
|
||||
Binput::get('threshold', null, false)
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.metrics.edit', [$metric->id])
|
||||
return cachet_redirect('dashboard.metrics.edit', [$metric->id])
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('<strong>%s</strong>', trans('dashboard.notifications.whoops')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.metrics.edit', [$metric->id])
|
||||
return cachet_redirect('dashboard.metrics.edit', [$metric->id])
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.edit.success')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,13 +100,13 @@ class ScheduleController extends Controller
|
||||
Binput::get('scheduled_at')
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.schedule.create')
|
||||
return cachet_redirect('dashboard.schedule.create')
|
||||
->withInput(Binput::all())
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.schedule.add.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.schedule')
|
||||
return cachet_redirect('dashboard.schedule')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.schedule.add.success')));
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ class ScheduleController extends Controller
|
||||
$messageBag = new MessageBag();
|
||||
$messageBag->add('scheduled_at', trans('validation.date', ['attribute' => 'scheduled time you supplied']));
|
||||
|
||||
return cachet_route('dashboard.schedule.edit', [$schedule->id])->withErrors($messageBag);
|
||||
return cachet_redirect('dashboard.schedule.edit', [$schedule->id])->withErrors($messageBag);
|
||||
}
|
||||
|
||||
$scheduleData['scheduled_at'] = $scheduledAt;
|
||||
@@ -155,13 +155,13 @@ class ScheduleController extends Controller
|
||||
try {
|
||||
$schedule->update($scheduleData);
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.schedule.edit', [$schedule->id])
|
||||
return cachet_redirect('dashboard.schedule.edit', [$schedule->id])
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.schedule.edit.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.schedule.edit', [$schedule->id])
|
||||
return cachet_redirect('dashboard.schedule.edit', [$schedule->id])
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.schedule.edit.success')));
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ class ScheduleController extends Controller
|
||||
{
|
||||
$schedule->delete();
|
||||
|
||||
return cachet_route('dashboard.schedule')
|
||||
return cachet_redirect('dashboard.schedule')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.schedule.delete.success')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ class SubscriberController extends Controller
|
||||
dispatch(new SubscribeSubscriberCommand($subscriber, $verified));
|
||||
}
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.subscribers.create')
|
||||
return cachet_redirect('dashboard.subscribers.create')
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.subscribers.add.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.subscribers.create')
|
||||
return cachet_redirect('dashboard.subscribers.create')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.subscribers.add.success')));
|
||||
}
|
||||
|
||||
@@ -84,6 +84,6 @@ class SubscriberController extends Controller
|
||||
{
|
||||
dispatch(new UnsubscribeSubscriberCommand($subscriber));
|
||||
|
||||
return cachet_route('dashboard.subscribers');
|
||||
return cachet_redirect('dashboard.subscribers');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,13 +87,13 @@ class TeamController extends Controller
|
||||
Binput::get('level')
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.team.create')
|
||||
return cachet_redirect('dashboard.team.create')
|
||||
->withInput(Binput::except('password'))
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.add.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.team.create')
|
||||
return cachet_redirect('dashboard.team.create')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.add.success')));
|
||||
}
|
||||
|
||||
@@ -111,13 +111,13 @@ class TeamController extends Controller
|
||||
try {
|
||||
$user->update($userData);
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.team.edit', [$user->id])
|
||||
return cachet_redirect('dashboard.team.edit', [$user->id])
|
||||
->withInput($userData)
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.team.edit', [$user->id])
|
||||
return cachet_redirect('dashboard.team.edit', [$user->id])
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')));
|
||||
}
|
||||
|
||||
@@ -133,13 +133,13 @@ class TeamController extends Controller
|
||||
array_unique(array_filter((array) Binput::get('emails')))
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.team.invite')
|
||||
return cachet_redirect('dashboard.team.invite')
|
||||
->withInput(Binput::except('password'))
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.invite.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.team.invite')
|
||||
return cachet_redirect('dashboard.team.invite')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.invite.success')));
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ class TeamController extends Controller
|
||||
{
|
||||
dispatch(new RemoveUserCommand($user));
|
||||
|
||||
return cachet_route('dashboard.team')
|
||||
return cachet_redirect('dashboard.team')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.delete.success')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,13 +58,13 @@ class UserController extends Controller
|
||||
try {
|
||||
Auth::user()->update($userData);
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('dashboard.user')
|
||||
return cachet_redirect('dashboard.user')
|
||||
->withInput($userData)
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('dashboard.user')
|
||||
return cachet_redirect('dashboard.user')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')));
|
||||
}
|
||||
|
||||
@@ -82,6 +82,6 @@ class UserController extends Controller
|
||||
|
||||
event(new UserRegeneratedApiTokenEvent($user));
|
||||
|
||||
return cachet_route('dashboard.user');
|
||||
return cachet_redirect('dashboard.user');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,14 +267,14 @@ class SetupController extends Controller
|
||||
return Response::json(['status' => 1]);
|
||||
}
|
||||
|
||||
return cachet_route('dashboard');
|
||||
return cachet_redirect('dashboard');
|
||||
}
|
||||
|
||||
if (Request::ajax()) {
|
||||
return Response::json(['errors' => $v->getMessageBag()], 400);
|
||||
}
|
||||
|
||||
return cachet_route('setup')->withInput()->withErrors($v->getMessageBag());
|
||||
return cachet_redirect('setup')->withInput()->withErrors($v->getMessageBag());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -76,7 +76,7 @@ class SignupController extends Controller
|
||||
User::LEVEL_USER
|
||||
));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('signup.invite', [$invite->code])
|
||||
return cachet_redirect('signup.invite', [$invite->code])
|
||||
->withInput(Binput::except('password'))
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('cachet.signup.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
@@ -84,7 +84,7 @@ class SignupController extends Controller
|
||||
|
||||
dispatch(new ClaimInviteCommand($invite));
|
||||
|
||||
return cachet_route('status-page')
|
||||
return cachet_redirect('status-page')
|
||||
->withSuccess(sprintf('<strong>%s</strong> %s', trans('dashboard.notifications.awesome'), trans('cachet.signup.success')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,17 +62,17 @@ class SubscribeController extends Controller
|
||||
try {
|
||||
$subscription = dispatch(new SubscribeSubscriberCommand($email, $verified));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('status-page')
|
||||
return cachet_redirect('status-page')
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('cachet.subscriber.email.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
if ($subscription->is_verified) {
|
||||
return cachet_route('status-page')->withSuccess(trans('cachet.subscriber.email.already-subscribed', ['email' => $email]));
|
||||
return cachet_redirect('status-page')->withSuccess(trans('cachet.subscriber.email.already-subscribed', ['email' => $email]));
|
||||
}
|
||||
|
||||
return cachet_route('subscribe.manage', $subscription->verify_code)
|
||||
return cachet_redirect('subscribe.manage', $subscription->verify_code)
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('cachet.subscriber.email.subscribed')));
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ class SubscribeController extends Controller
|
||||
dispatch(new VerifySubscriberCommand($subscriber));
|
||||
}
|
||||
|
||||
return cachet_route('status-page')
|
||||
return cachet_redirect('status-page')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('cachet.subscriber.email.verified')));
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class SubscribeController extends Controller
|
||||
dispatch(new UnsubscribeSubscriberCommand($subscriber, $subscription));
|
||||
}
|
||||
|
||||
return cachet_route('status-page')
|
||||
return cachet_redirect('status-page')
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('cachet.subscriber.email.unsubscribed')));
|
||||
}
|
||||
|
||||
@@ -184,13 +184,13 @@ class SubscribeController extends Controller
|
||||
try {
|
||||
dispatch(new UpdateSubscriberSubscriptionCommand($subscriber, Binput::get('subscriptions')));
|
||||
} catch (ValidationException $e) {
|
||||
return cachet_route('subscribe.manage', $subscriber->verify_code)
|
||||
return cachet_redirect('subscribe.manage', $subscriber->verify_code)
|
||||
->withInput(Binput::all())
|
||||
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('cachet.subscriber.email.failure')))
|
||||
->withErrors($e->getMessageBag());
|
||||
}
|
||||
|
||||
return cachet_route('subscribe.manage', $subscriber->verify_code)
|
||||
return cachet_redirect('subscribe.manage', $subscriber->verify_code)
|
||||
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('cachet.subscriber.email.subscribed')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,3 +156,24 @@ if (!function_exists('cachet_route')) {
|
||||
return app('url')->route("{$domain}::{$method}:{$name}", $parameters, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('cachet_redirect')) {
|
||||
/**
|
||||
* Create a new redirect response to a named route, which resides in a given domain.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $parameters
|
||||
* @param int $status
|
||||
* @param array $headers
|
||||
* @param string $method
|
||||
* @param string $domain
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
function cachet_redirect($name, $parameters = [], $status = 302, $headers = [], $method = 'get', $domain = 'core')
|
||||
{
|
||||
$url = cachet_route($name, $parameters, $method, $domain);
|
||||
|
||||
return app('redirect')->to($url, $status, $headers);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user