Completely refactor all routes

This commit is contained in:
James Brooks
2016-10-12 21:31:07 +01:00
parent 446e428486
commit 5a9f6134c4
90 changed files with 486 additions and 341 deletions
+5 -5
View File
@@ -58,17 +58,17 @@ class AuthController extends Controller
if (Auth::user()->hasTwoFactor) {
Session::put('2fa_id', Auth::user()->id);
return Redirect::route('auth.two-factor');
return cachet_route('auth.two-factor');
}
Auth::attempt($loginData, $rememberUser);
event(new UserLoggedInEvent(Auth::user()));
return Redirect::intended('dashboard');
return Redirect::intended(cachet_route('dashboard'));
}
return Redirect::route('auth.login')
return cachet_route('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 Redirect::route('auth.login')->withError(trans('forms.login.invalid-token'));
return cachet_route('auth.login')->withError(trans('forms.login.invalid-token'));
}
}
return Redirect::route('auth.login')->withError(trans('forms.login.invalid-token'));
return cachet_route('auth.login')->withError(trans('forms.login.invalid-token'));
}
/**
@@ -23,7 +23,6 @@ use CachetHQ\Cachet\Models\ComponentGroup;
use CachetHQ\Cachet\Models\Tag;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
class ComponentController extends Controller
@@ -45,13 +44,13 @@ class ComponentController extends Controller
$this->subMenu = [
'components' => [
'title' => trans('dashboard.components.components'),
'url' => route('dashboard.components.index'),
'url' => cachet_route('dashboard.components'),
'icon' => 'ion-ios-browsers',
'active' => false,
],
'groups' => [
'title' => trans_choice('dashboard.components.groups.groups', 2),
'url' => route('dashboard.components.groups'),
'url' => cachet_route('dashboard.components.groups'),
'icon' => 'ion-folder',
'active' => false,
],
@@ -138,7 +137,7 @@ class ComponentController extends Controller
$componentData['enabled']
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.components.edit', ['id' => $component->id])
return cachet_route('dashboard.components.edit', [$component->id])
->withInput(Binput::all())
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.edit.failure')))
->withErrors($e->getMessageBag());
@@ -154,7 +153,7 @@ class ComponentController extends Controller
$component->tags()->sync($componentTags);
return Redirect::route('dashboard.components.edit', ['id' => $component->id])
return cachet_route('dashboard.components.edit', [$component->id])
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.edit.success')));
}
@@ -191,7 +190,7 @@ class ComponentController extends Controller
$componentData['enabled']
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.components.add')
return cachet_route('dashboard.components.create')
->withInput(Binput::all())
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.components.add.failure')))
->withErrors($e->getMessageBag());
@@ -207,7 +206,7 @@ class ComponentController extends Controller
$component->tags()->sync($componentTags);
return Redirect::route('dashboard.components.index')
return cachet_route('dashboard.components')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.add.success')));
}
@@ -222,7 +221,7 @@ class ComponentController extends Controller
{
dispatch(new RemoveComponentCommand($component));
return Redirect::route('dashboard.components.index')
return cachet_route('dashboard.components')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.delete.success')));
}
@@ -237,7 +236,7 @@ class ComponentController extends Controller
{
dispatch(new RemoveComponentGroupCommand($group));
return Redirect::route('dashboard.components.groups')
return cachet_route('dashboard.components.groups')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.delete.success')));
}
@@ -281,13 +280,13 @@ class ComponentController extends Controller
Binput::get('visible')
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.components.groups.add')
return cachet_route('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 Redirect::route('dashboard.components.groups')
return cachet_route('dashboard.components.groups')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.groups.add.success')));
}
@@ -309,13 +308,13 @@ class ComponentController extends Controller
Binput::get('visible')
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.components.groups.edit', ['id' => $group->id])
return cachet_route('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 Redirect::route('dashboard.components.groups.edit', ['id' => $group->id])
return cachet_route('dashboard.components.groups.edit', [$group->id])
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.components.groups.edit.success')));
}
}
@@ -21,7 +21,6 @@ use Illuminate\Contracts\Auth\Guard;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
use Jenssegers\Date\Date;
@@ -83,7 +82,7 @@ class DashboardController extends Controller
*/
public function redirectAdmin()
{
return Redirect::route('dashboard.index');
return cachet_route('dashboard');
}
/**
@@ -23,7 +23,6 @@ use CachetHQ\Cachet\Models\IncidentTemplate;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
/**
@@ -61,13 +60,13 @@ class IncidentController extends Controller
$this->subMenu = [
'incidents' => [
'title' => trans('dashboard.incidents.incidents'),
'url' => route('dashboard.incidents.index'),
'url' => cachet_route('dashboard.incidents'),
'icon' => 'ion-android-checkmark-circle',
'active' => true,
],
'schedule' => [
'title' => trans('dashboard.schedule.schedule'),
'url' => route('dashboard.schedule.index'),
'url' => cachet_route('dashboard.schedule'),
'icon' => 'ion-android-calendar',
'active' => false,
],
@@ -139,13 +138,13 @@ class IncidentController extends Controller
null
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.incidents.add')
return cachet_route('dashboard.incidents.create')
->withInput(Binput::all())
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.incidents.add.failure')))
->withErrors($e->getMessageBag());
}
return Redirect::route('dashboard.incidents.index')
return cachet_route('dashboard.incidents')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.add.success')));
}
@@ -185,7 +184,7 @@ class IncidentController extends Controller
{
$template->delete();
return Redirect::route('dashboard.templates.index')
return cachet_route('dashboard.templates')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.delete.success')));
}
@@ -199,13 +198,13 @@ class IncidentController extends Controller
try {
IncidentTemplate::create(Binput::get('template'));
} catch (ValidationException $e) {
return Redirect::route('dashboard.templates.add')
return cachet_route('dashboard.templates.create')
->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.index')
return cachet_route('dashboard.templates')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.add.success')));
}
@@ -220,7 +219,7 @@ class IncidentController extends Controller
{
dispatch(new RemoveIncidentCommand($incident));
return Redirect::route('dashboard.incidents.index')
return cachet_route('dashboard.incidents')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.delete.success')));
}
@@ -265,7 +264,7 @@ class IncidentController extends Controller
null
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.incidents.edit', ['id' => $incident->id])
return cachet_route('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());
@@ -275,7 +274,7 @@ class IncidentController extends Controller
$incident->component->update(['status' => Binput::get('component_status')]);
}
return Redirect::route('dashboard.incidents.edit', ['id' => $incident->id])
return cachet_route('dashboard.incidents.edit', ['id' => $incident->id])
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.edit.success')));
}
@@ -291,12 +290,12 @@ class IncidentController extends Controller
try {
$template->update(Binput::get('template'));
} catch (ValidationException $e) {
return Redirect::route('dashboard.templates.edit', ['id' => $template->id])
return cachet_route('dashboard.templates.edit', ['id' => $template->id])
->withUpdatedTemplate($template)
->withTemplateErrors($e->getMessageBag()->getErrors());
}
return Redirect::route('dashboard.templates.edit', ['id' => $template->id])
return cachet_route('dashboard.templates.edit', ['id' => $template->id])
->withUpdatedTemplate($template);
}
@@ -329,13 +328,13 @@ class IncidentController extends Controller
$this->auth->user()
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.incidents.update', ['id' => $incident->id])
return cachet_route('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 Redirect::route('dashboard.incidents.index')
return cachet_route('dashboard.incidents')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.delete.success')));
}
}
@@ -19,7 +19,6 @@ use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Cachet\Models\MetricPoint;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
class MetricController extends Controller
@@ -83,13 +82,13 @@ class MetricController extends Controller
$metricData['threshold']
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.metrics.add')
return cachet_route('dashboard.metrics.create')
->withInput(Binput::all())
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.metrics.add.failure')))
->withErrors($e->getMessageBag());
}
return Redirect::route('dashboard.metrics.index')
return cachet_route('dashboard.metrics')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.add.success')));
}
@@ -115,7 +114,7 @@ class MetricController extends Controller
{
dispatch(new RemoveMetricCommand($metric));
return Redirect::route('dashboard.metrics.index')
return cachet_route('dashboard.metrics')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.delete.success')));
}
@@ -156,13 +155,13 @@ class MetricController extends Controller
Binput::get('threshold', null, false)
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.metrics.edit', ['id' => $metric->id])
return cachet_route('dashboard.metrics.edit', [$metric->id])
->withInput(Binput::all())
->withTitle(sprintf('<strong>%s</strong>', trans('dashboard.notifications.whoops')))
->withErrors($e->getMessageBag());
}
return Redirect::route('dashboard.metrics.edit', ['id' => $metric->id])
return cachet_route('dashboard.metrics.edit', [$metric->id])
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.metrics.edit.success')));
}
}
@@ -18,7 +18,6 @@ use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\IncidentTemplate;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
use Illuminate\Support\MessageBag;
use Jenssegers\Date\Date;
@@ -42,13 +41,13 @@ class ScheduleController extends Controller
$this->subMenu = [
'incidents' => [
'title' => trans('dashboard.incidents.incidents'),
'url' => route('dashboard.incidents.index'),
'url' => cachet_route('dashboard.incidents'),
'icon' => 'ion-android-checkmark-circle',
'active' => false,
],
'schedule' => [
'title' => trans('dashboard.schedule.schedule'),
'url' => route('dashboard.schedule.index'),
'url' => cachet_route('dashboard.schedule'),
'icon' => 'ion-android-calendar',
'active' => true,
],
@@ -101,13 +100,13 @@ class ScheduleController extends Controller
Binput::get('scheduled_at')
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.schedule.add')
return cachet_route('dashboard.schedule.create')
->withInput(Binput::all())
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.schedule.add.failure')))
->withErrors($e->getMessageBag());
}
return Redirect::route('dashboard.schedule.index')
return cachet_route('dashboard.schedule')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.schedule.add.success')));
}
@@ -146,7 +145,7 @@ class ScheduleController extends Controller
$messageBag = new MessageBag();
$messageBag->add('scheduled_at', trans('validation.date', ['attribute' => 'scheduled time you supplied']));
return Redirect::route('dashboard.schedule.edit', ['id' => $schedule->id])->withErrors($messageBag);
return cachet_route('dashboard.schedule.edit', [$schedule->id])->withErrors($messageBag);
}
$scheduleData['scheduled_at'] = $scheduledAt;
@@ -156,13 +155,13 @@ class ScheduleController extends Controller
try {
$schedule->update($scheduleData);
} catch (ValidationException $e) {
return Redirect::route('dashboard.schedule.edit', ['id' => $schedule->id])
return cachet_route('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 Redirect::route('dashboard.schedule.edit', ['id' => $schedule->id])
return cachet_route('dashboard.schedule.edit', [$schedule->id])
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.schedule.edit.success')));
}
@@ -177,7 +176,7 @@ class ScheduleController extends Controller
{
$schedule->delete();
return Redirect::route('dashboard.schedule.index')
return cachet_route('dashboard.schedule')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.schedule.delete.success')));
}
}
@@ -44,55 +44,55 @@ class SettingsController extends Controller
$this->subMenu = [
'setup' => [
'title' => trans('dashboard.settings.app-setup.app-setup'),
'url' => route('dashboard.settings.setup'),
'url' => cachet_route('dashboard.settings.setup'),
'icon' => 'ion-gear-b',
'active' => false,
],
'theme' => [
'title' => trans('dashboard.settings.theme.theme'),
'url' => route('dashboard.settings.theme'),
'url' => cachet_route('dashboard.settings.theme'),
'icon' => 'ion-paintbrush',
'active' => false,
],
'stylesheet' => [
'title' => trans('dashboard.settings.stylesheet.stylesheet'),
'url' => route('dashboard.settings.stylesheet'),
'url' => cachet_route('dashboard.settings.stylesheet'),
'icon' => 'ion-paintbucket',
'active' => false,
],
'customization' => [
'title' => trans('dashboard.settings.customization.customization'),
'url' => route('dashboard.settings.customization'),
'url' => cachet_route('dashboard.settings.customization'),
'icon' => 'ion-wand',
'active' => false,
],
'localization' => [
'title' => trans('dashboard.settings.localization.localization'),
'url' => route('dashboard.settings.localization'),
'url' => cachet_route('dashboard.settings.localization'),
'icon' => 'ion-earth',
'active' => false,
],
'security' => [
'title' => trans('dashboard.settings.security.security'),
'url' => route('dashboard.settings.security'),
'url' => cachet_route('dashboard.settings.security'),
'icon' => 'ion-lock-combination',
'active' => false,
],
'analytics' => [
'title' => trans('dashboard.settings.analytics.analytics'),
'url' => route('dashboard.settings.analytics'),
'url' => cachet_route('dashboard.settings.analytics'),
'icon' => 'ion-stats-bars',
'active' => false,
],
'log' => [
'title' => trans('dashboard.settings.log.log'),
'url' => route('dashboard.settings.log'),
'url' => cachet_route('dashboard.settings.log'),
'icon' => 'ion-document-text',
'active' => false,
],
'credits' => [
'title' => trans('dashboard.settings.credits.credits'),
'url' => route('dashboard.settings.credits'),
'url' => cachet_route('dashboard.settings.credits'),
'icon' => 'ion-ios-list',
'active' => false,
],
@@ -18,7 +18,6 @@ use CachetHQ\Cachet\Models\Subscriber;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
class SubscriberController extends Controller
@@ -62,13 +61,13 @@ class SubscriberController extends Controller
dispatch(new SubscribeSubscriberCommand($subscriber, $verified));
}
} catch (ValidationException $e) {
return Redirect::route('dashboard.subscribers.add')
return cachet_route('dashboard.subscribers.create')
->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')
return cachet_route('dashboard.subscribers.create')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.subscribers.add.success')));
}
@@ -85,6 +84,6 @@ class SubscriberController extends Controller
{
dispatch(new UnsubscribeSubscriberCommand($subscriber));
return Redirect::route('dashboard.subscribers.index');
return cachet_route('dashboard.subscribers');
}
}
@@ -18,7 +18,6 @@ use CachetHQ\Cachet\Bus\Commands\User\RemoveUserCommand;
use CachetHQ\Cachet\Models\User;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
class TeamController extends Controller
@@ -88,13 +87,13 @@ class TeamController extends Controller
Binput::get('level')
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.team.add')
return cachet_route('dashboard.team.create')
->withInput(Binput::except('password'))
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.add.failure')))
->withErrors($e->getMessageBag());
}
return Redirect::route('dashboard.team.add')
return cachet_route('dashboard.team.create')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.add.success')));
}
@@ -112,13 +111,13 @@ class TeamController extends Controller
try {
$user->update($userData);
} catch (ValidationException $e) {
return Redirect::route('dashboard.team.edit', ['id' => $user->id])
return cachet_route('dashboard.team.edit', [$user->id])
->withInput($userData)
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')))
->withErrors($e->getMessageBag());
}
return Redirect::route('dashboard.team.edit', ['id' => $user->id])
return cachet_route('dashboard.team.edit', [$user->id])
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')));
}
@@ -134,13 +133,13 @@ class TeamController extends Controller
array_unique(array_filter((array) Binput::get('emails')))
));
} catch (ValidationException $e) {
return Redirect::route('dashboard.team.invite')
return cachet_route('dashboard.team.invite')
->withInput(Binput::except('password'))
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.invite.failure')))
->withErrors($e->getMessageBag());
}
return Redirect::route('dashboard.team.invite')
return cachet_route('dashboard.team.invite')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.invite.success')));
}
@@ -155,7 +154,7 @@ class TeamController extends Controller
{
dispatch(new RemoveUserCommand($user));
return Redirect::route('dashboard.team.index')
return cachet_route('dashboard.team')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.delete.success')));
}
}
@@ -19,7 +19,6 @@ use CachetHQ\Cachet\Models\User;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
use PragmaRX\Google2FA\Vendor\Laravel\Facade as Google2FA;
@@ -59,13 +58,13 @@ class UserController extends Controller
try {
Auth::user()->update($userData);
} catch (ValidationException $e) {
return Redirect::route('dashboard.user')
return cachet_route('dashboard.user')
->withInput($userData)
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.team.edit.failure')))
->withErrors($e->getMessageBag());
}
return Redirect::route('dashboard.user')
return cachet_route('dashboard.user')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.team.edit.success')));
}
@@ -83,6 +82,6 @@ class UserController extends Controller
event(new UserRegeneratedApiTokenEvent($user));
return Redirect::route('dashboard.user');
return cachet_route('dashboard.user');
}
}
+1 -1
View File
@@ -104,7 +104,7 @@ class FeedController extends Controller
$this->feed->add(
$incident->name,
Config::get('setting.app_name'),
Str::canonicalize(route('incident', ['id' => $incident->id])),
Str::canonicalize(cachet_route('incident', [$incident->id])),
$isRss ? $incident->created_at->toRssString() : $incident->created_at->toAtomString(),
$isRss ? $incident->message : Markdown::convertToHtml($incident->message)
);
+2 -3
View File
@@ -19,7 +19,6 @@ use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Validator;
@@ -268,14 +267,14 @@ class SetupController extends Controller
return Response::json(['status' => 1]);
}
return Redirect::to('dashboard');
return cachet_route('dashboard');
}
if (Request::ajax()) {
return Response::json(['errors' => $v->getMessageBag()], 400);
}
return Redirect::route('setup.index')->withInput()->withErrors($v->getMessageBag());
return cachet_route('setup')->withInput()->withErrors($v->getMessageBag());
}
/**
+2 -3
View File
@@ -18,7 +18,6 @@ use CachetHQ\Cachet\Models\Invite;
use CachetHQ\Cachet\Models\User;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -77,7 +76,7 @@ class SignupController extends Controller
User::LEVEL_USER
));
} catch (ValidationException $e) {
return Redirect::route('signup.invite', ['code' => $invite->code])
return cachet_route('signup.invite', [$invite->code])
->withInput(Binput::except('password'))
->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('cachet.signup.failure')))
->withErrors($e->getMessageBag());
@@ -85,7 +84,7 @@ class SignupController extends Controller
dispatch(new ClaimInviteCommand($invite));
return Redirect::route('status-page')
return cachet_route('status-page')
->withSuccess(sprintf('<strong>%s</strong> %s', trans('dashboard.notifications.awesome'), trans('cachet.signup.success')));
}
}
+7 -8
View File
@@ -26,7 +26,6 @@ use GrahamCampbell\Markdown\Facades\Markdown;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\View;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -63,17 +62,17 @@ class SubscribeController extends Controller
try {
$subscription = dispatch(new SubscribeSubscriberCommand($email, $verified));
} catch (ValidationException $e) {
return Redirect::route('status-page')
return cachet_route('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 Redirect::route('status-page')->withSuccess(trans('cachet.subscriber.email.already-subscribed', ['email' => $email]));
return cachet_route('status-page')->withSuccess(trans('cachet.subscriber.email.already-subscribed', ['email' => $email]));
}
return Redirect::route('subscribe.manage', $subscription->verify_code)
return cachet_route('subscribe.manage', $subscription->verify_code)
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('cachet.subscriber.email.subscribed')));
}
@@ -100,7 +99,7 @@ class SubscribeController extends Controller
dispatch(new VerifySubscriberCommand($subscriber));
}
return Redirect::route('status-page')
return cachet_route('status-page')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('cachet.subscriber.email.verified')));
}
@@ -130,7 +129,7 @@ class SubscribeController extends Controller
dispatch(new UnsubscribeSubscriberCommand($subscriber, $subscription));
}
return Redirect::route('status-page')
return cachet_route('status-page')
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('cachet.subscriber.email.unsubscribed')));
}
@@ -185,13 +184,13 @@ class SubscribeController extends Controller
try {
dispatch(new UpdateSubscriberSubscriptionCommand($subscriber, Binput::get('subscriptions')));
} catch (ValidationException $e) {
return Redirect::route('subscribe.manage', $subscriber->verify_code)
return cachet_route('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 Redirect::route('subscribe.manage', $subscriber->verify_code)
return cachet_route('subscribe.manage', $subscriber->verify_code)
->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('cachet.subscriber.email.subscribed')));
}
}