From 5a9f6134c48383d779535b572f6ee2076932c3ad Mon Sep 17 00:00:00 2001 From: James Brooks Date: Wed, 12 Oct 2016 21:31:07 +0100 Subject: [PATCH] Completely refactor all routes --- ...omponentUpdateEmailNotificationHandler.php | 2 +- .../SendIncidentEmailNotificationHandler.php | 4 +- ...endMaintenanceEmailNotificationHandler.php | 4 +- .../User/SendInviteUserEmailHandler.php | 2 +- .../Providers/RouteServiceProvider.php | 9 ++- app/Http/Controllers/AuthController.php | 10 ++-- .../Dashboard/ComponentController.php | 25 ++++----- .../Dashboard/DashboardController.php | 3 +- .../Dashboard/IncidentController.php | 29 +++++----- .../Dashboard/MetricController.php | 11 ++-- .../Dashboard/ScheduleController.php | 17 +++--- .../Dashboard/SettingsController.php | 18 +++--- .../Dashboard/SubscriberController.php | 7 +-- .../Controllers/Dashboard/TeamController.php | 15 +++-- .../Controllers/Dashboard/UserController.php | 7 +-- app/Http/Controllers/FeedController.php | 2 +- app/Http/Controllers/SetupController.php | 5 +- app/Http/Controllers/SignupController.php | 5 +- app/Http/Controllers/SubscribeController.php | 15 +++-- app/Http/Middleware/SetupAlreadyCompleted.php | 3 +- app/Http/Middleware/SubscribersConfigured.php | 3 +- app/Http/Routes/ApiRoutes.php | 6 +- app/Http/Routes/AuthRoutes.php | 13 +++-- app/Http/Routes/Dashboard/ApiRoutes.php | 1 - app/Http/Routes/Dashboard/BaseRoutes.php | 9 ++- app/Http/Routes/Dashboard/ComponentRoutes.php | 56 +++++++++++++------ app/Http/Routes/Dashboard/IncidentRoutes.php | 39 ++++++++----- app/Http/Routes/Dashboard/MetricRoutes.php | 28 +++++++--- app/Http/Routes/Dashboard/ScheduleRoutes.php | 27 +++++---- app/Http/Routes/Dashboard/SettingRoutes.php | 25 +++++---- .../Routes/Dashboard/SubscriberRoutes.php | 19 +++++-- app/Http/Routes/Dashboard/TeamRoutes.php | 36 ++++++++---- app/Http/Routes/Dashboard/TemplateRoutes.php | 28 +++++++--- app/Http/Routes/Dashboard/UserRoutes.php | 14 +++-- app/Http/Routes/FeedRoutes.php | 9 ++- app/Http/Routes/SetupRoutes.php | 28 ++++++++-- app/Http/Routes/SignupRoutes.php | 12 ++-- app/Http/Routes/StatusPageRoutes.php | 17 ++++-- app/Http/Routes/SubscribeRoutes.php | 17 +++--- app/Presenters/IncidentPresenter.php | 2 +- app/Presenters/IncidentUpdatePresenter.php | 2 +- app/helpers.php | 17 ++++++ resources/views/auth/login.blade.php | 4 +- .../views/auth/two-factor-auth.blade.php | 2 +- .../views/dashboard/components/add.blade.php | 4 +- .../views/dashboard/components/edit.blade.php | 4 +- .../dashboard/components/groups/add.blade.php | 4 +- .../components/groups/edit.blade.php | 2 +- .../components/groups/index.blade.php | 6 +- .../dashboard/components/index.blade.php | 6 +- .../views/dashboard/incidents/add.blade.php | 2 +- .../views/dashboard/incidents/edit.blade.php | 2 +- .../views/dashboard/incidents/index.blade.php | 8 +-- .../dashboard/incidents/update.blade.php | 2 +- resources/views/dashboard/index.blade.php | 6 +- .../views/dashboard/metrics/add.blade.php | 2 +- .../views/dashboard/metrics/edit.blade.php | 2 +- .../views/dashboard/metrics/index.blade.php | 6 +- .../dashboard/partials/sidebar.blade.php | 26 ++++----- .../partials/welcome-modal.blade.php | 12 ++-- .../views/dashboard/schedule/add.blade.php | 2 +- .../views/dashboard/schedule/edit.blade.php | 2 +- .../views/dashboard/schedule/index.blade.php | 6 +- .../dashboard/settings/analytics.blade.php | 2 +- .../dashboard/settings/app-setup.blade.php | 2 +- .../settings/customization.blade.php | 2 +- .../dashboard/settings/localization.blade.php | 2 +- .../dashboard/settings/security.blade.php | 2 +- .../dashboard/settings/stylesheet.blade.php | 2 +- .../views/dashboard/settings/theme.blade.php | 2 +- .../views/dashboard/subscribers/add.blade.php | 4 +- .../dashboard/subscribers/index.blade.php | 4 +- resources/views/dashboard/team/add.blade.php | 4 +- resources/views/dashboard/team/edit.blade.php | 4 +- .../views/dashboard/team/index.blade.php | 4 +- .../views/dashboard/team/invite.blade.php | 4 +- .../views/dashboard/templates/add.blade.php | 2 +- .../views/dashboard/templates/edit.blade.php | 2 +- .../views/dashboard/templates/index.blade.php | 6 +- .../views/dashboard/user/index.blade.php | 4 +- resources/views/layout/master.blade.php | 4 +- resources/views/partials/footer.blade.php | 10 ++-- resources/views/partials/incident.blade.php | 6 +- .../views/partials/modals/subscribe.blade.php | 10 ++-- .../views/partials/modules/timeline.blade.php | 4 +- resources/views/partials/nav.blade.php | 12 ++-- resources/views/setup/index.blade.php | 2 +- resources/views/signup.blade.php | 4 +- resources/views/subscribe/manage.blade.php | 8 +-- resources/views/subscribe/subscribe.blade.php | 4 +- 90 files changed, 486 insertions(+), 341 deletions(-) diff --git a/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php b/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php index 95c138d28ea3..7ed768a3868c 100644 --- a/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php +++ b/app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php @@ -105,7 +105,7 @@ public function notify(Component $component, Subscriber $subscriber) ]; $mail['email'] = $subscriber->email; - $mail['manage_link'] = route('subscribe.manage', ['code' => $subscriber->verify_code]); + $mail['manage_link'] = cachet_route('subscribe.manage', [$subscriber->verify_code]); $this->mailer->queue([ 'html' => 'emails.components.update-html', diff --git a/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php b/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php index 3558ff7ccd31..24b10c7d0e70 100644 --- a/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php +++ b/app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php @@ -119,8 +119,8 @@ public function notify(IncidentWasReportedEvent $event, $subscriber) 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, 'token' => $subscriber->token, - 'manage_link' => route('subscribe.manage', ['code' => $subscriber->verify_code]), - 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]), + 'manage_link' => cachet_route('subscribe.manage', [$subscriber->verify_code]), + 'unsubscribe_link' => cachet_route('subscribe.unsubscribe', [$subscriber->verify_code]), ]; $this->mailer->queue([ diff --git a/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php b/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php index c9a12462d416..8c922ea59427 100644 --- a/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php +++ b/app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php @@ -116,8 +116,8 @@ public function notify(MaintenanceWasScheduledEvent $event, $subscriber) 'html_content' => $incident->formattedMessage, 'text_content' => $incident->message, 'token' => $subscriber->token, - 'manage_link' => route('subscribe.manage', ['code' => $subscriber->verify_code]), - 'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]), + 'manage_link' => cachet_route('subscribe.manage', [$subscriber->verify_code]), + 'unsubscribe_link' => cachet_route('subscribe.unsubscribe', [$subscriber->verify_code]), ]; $this->mailer->queue([ diff --git a/app/Bus/Handlers/Events/User/SendInviteUserEmailHandler.php b/app/Bus/Handlers/Events/User/SendInviteUserEmailHandler.php index 419baa3a9615..12111cdf78bf 100644 --- a/app/Bus/Handlers/Events/User/SendInviteUserEmailHandler.php +++ b/app/Bus/Handlers/Events/User/SendInviteUserEmailHandler.php @@ -48,7 +48,7 @@ public function handle(UserWasInvitedEvent $event) $mail = [ 'email' => $event->invite->email, 'subject' => 'You have been invited.', - 'link' => route('signup.invite', ['code' => $event->invite->code]), + 'link' => cachet_route('signup.invite', [$event->invite->code]), ]; $this->mailer->queue([ diff --git a/app/Foundation/Providers/RouteServiceProvider.php b/app/Foundation/Providers/RouteServiceProvider.php index 742bdc106fcd..ad91ca50ecb6 100644 --- a/app/Foundation/Providers/RouteServiceProvider.php +++ b/app/Foundation/Providers/RouteServiceProvider.php @@ -14,6 +14,13 @@ use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Routing\Router; +/** + * This is the route service provider. + * + * @author James Brooks + * @author Joseph Cohen + * @author Graham Campbell + */ class RouteServiceProvider extends ServiceProvider { /** @@ -67,7 +74,7 @@ protected function registerBindings() */ public function map(Router $router) { - $router->group(['namespace' => $this->namespace], function (Router $router) { + $router->group(['namespace' => $this->namespace, 'as' => 'core::'], function (Router $router) { $path = app_path('Http/Routes'); foreach (glob("{$path}/*{,/*}.php", GLOB_BRACE) as $file) { diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 5593310a55e0..691daba78146 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -58,17 +58,17 @@ public function postLogin() 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 @@ public function postTwoFactor() // 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')); } /** diff --git a/app/Http/Controllers/Dashboard/ComponentController.php b/app/Http/Controllers/Dashboard/ComponentController.php index 68337dded1d3..03af1ed29cbe 100644 --- a/app/Http/Controllers/Dashboard/ComponentController.php +++ b/app/Http/Controllers/Dashboard/ComponentController.php @@ -23,7 +23,6 @@ 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 @@ public function __construct() $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 @@ public function updateComponentAction(Component $component) $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 @@ public function updateComponentAction(Component $component) $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 @@ public function createComponentAction() $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 @@ public function createComponentAction() $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 @@ public function deleteComponentAction(Component $component) { 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 @@ public function deleteComponentGroupAction(ComponentGroup $group) { 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 @@ public function postAddComponentGroup() 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 @@ public function updateComponentGroupAction(ComponentGroup $group) 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'))); } } diff --git a/app/Http/Controllers/Dashboard/DashboardController.php b/app/Http/Controllers/Dashboard/DashboardController.php index 94d07c476492..d1e84d0de2d0 100644 --- a/app/Http/Controllers/Dashboard/DashboardController.php +++ b/app/Http/Controllers/Dashboard/DashboardController.php @@ -21,7 +21,6 @@ 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 @@ public function __construct(Feed $feed, Guard $guard) */ public function redirectAdmin() { - return Redirect::route('dashboard.index'); + return cachet_route('dashboard'); } /** diff --git a/app/Http/Controllers/Dashboard/IncidentController.php b/app/Http/Controllers/Dashboard/IncidentController.php index 9d70716463d7..5b42ed00e4a7 100644 --- a/app/Http/Controllers/Dashboard/IncidentController.php +++ b/app/Http/Controllers/Dashboard/IncidentController.php @@ -23,7 +23,6 @@ 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 @@ public function __construct(Guard $auth) $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 @@ public function createIncidentAction() 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 @@ public function deleteTemplateAction(IncidentTemplate $template) { $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 @@ public function createIncidentTemplateAction() 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 @@ public function deleteIncidentAction(Incident $incident) { 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 @@ public function editIncidentAction(Incident $incident) 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 @@ public function editIncidentAction(Incident $incident) $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 @@ public function editTemplateAction(IncidentTemplate $template) 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 @@ public function createIncidentUpdateAction(Incident $incident) $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'))); } } diff --git a/app/Http/Controllers/Dashboard/MetricController.php b/app/Http/Controllers/Dashboard/MetricController.php index 447e9fedbed6..13324bd27ffb 100644 --- a/app/Http/Controllers/Dashboard/MetricController.php +++ b/app/Http/Controllers/Dashboard/MetricController.php @@ -19,7 +19,6 @@ 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 @@ public function createMetricAction() $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 @@ public function deleteMetricAction(Metric $metric) { 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 @@ public function editMetricAction(Metric $metric) 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('%s', 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'))); } } diff --git a/app/Http/Controllers/Dashboard/ScheduleController.php b/app/Http/Controllers/Dashboard/ScheduleController.php index bead6cfd3d62..6f24a3c0cf01 100644 --- a/app/Http/Controllers/Dashboard/ScheduleController.php +++ b/app/Http/Controllers/Dashboard/ScheduleController.php @@ -18,7 +18,6 @@ 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 @@ public function __construct() $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 @@ public function addScheduleAction() 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 @@ public function editScheduleAction(Incident $schedule) $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 @@ public function editScheduleAction(Incident $schedule) 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 @@ public function deleteScheduleAction(Incident $schedule) { $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'))); } } diff --git a/app/Http/Controllers/Dashboard/SettingsController.php b/app/Http/Controllers/Dashboard/SettingsController.php index d4a31250d901..62f2ffe62f89 100644 --- a/app/Http/Controllers/Dashboard/SettingsController.php +++ b/app/Http/Controllers/Dashboard/SettingsController.php @@ -44,55 +44,55 @@ public function __construct() $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, ], diff --git a/app/Http/Controllers/Dashboard/SubscriberController.php b/app/Http/Controllers/Dashboard/SubscriberController.php index 9e1e6185d85b..5ab4438d84f1 100644 --- a/app/Http/Controllers/Dashboard/SubscriberController.php +++ b/app/Http/Controllers/Dashboard/SubscriberController.php @@ -18,7 +18,6 @@ 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 @@ public function createSubscriberAction() 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 @@ public function deleteSubscriberAction(Subscriber $subscriber) { dispatch(new UnsubscribeSubscriberCommand($subscriber)); - return Redirect::route('dashboard.subscribers.index'); + return cachet_route('dashboard.subscribers'); } } diff --git a/app/Http/Controllers/Dashboard/TeamController.php b/app/Http/Controllers/Dashboard/TeamController.php index 86715dd8f59e..b3c925a86410 100644 --- a/app/Http/Controllers/Dashboard/TeamController.php +++ b/app/Http/Controllers/Dashboard/TeamController.php @@ -18,7 +18,6 @@ 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 @@ public function postAddUser() 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 @@ public function postUpdateUser(User $user) 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 @@ public function postInviteUser() 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 @@ public function deleteUser(User $user) { 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'))); } } diff --git a/app/Http/Controllers/Dashboard/UserController.php b/app/Http/Controllers/Dashboard/UserController.php index d665346e730c..a04b49289c7f 100644 --- a/app/Http/Controllers/Dashboard/UserController.php +++ b/app/Http/Controllers/Dashboard/UserController.php @@ -19,7 +19,6 @@ 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 @@ public function postUser() 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 @@ public function regenerateApiKey(User $user) event(new UserRegeneratedApiTokenEvent($user)); - return Redirect::route('dashboard.user'); + return cachet_route('dashboard.user'); } } diff --git a/app/Http/Controllers/FeedController.php b/app/Http/Controllers/FeedController.php index e9510fd94e58..3d1c6ca2649b 100644 --- a/app/Http/Controllers/FeedController.php +++ b/app/Http/Controllers/FeedController.php @@ -104,7 +104,7 @@ private function feedAddItem(Incident $incident, $isRss) $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) ); diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index b2aa4f8fef2d..af02c861f7cd 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -19,7 +19,6 @@ 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 @@ public function postStep3() 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()); } /** diff --git a/app/Http/Controllers/SignupController.php b/app/Http/Controllers/SignupController.php index 2eda8d87a7ab..a36af25fa3f2 100644 --- a/app/Http/Controllers/SignupController.php +++ b/app/Http/Controllers/SignupController.php @@ -18,7 +18,6 @@ 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 @@ public function postSignup($code = null) 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 @@ public function postSignup($code = null) dispatch(new ClaimInviteCommand($invite)); - return Redirect::route('status-page') + return cachet_route('status-page') ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('cachet.signup.success'))); } } diff --git a/app/Http/Controllers/SubscribeController.php b/app/Http/Controllers/SubscribeController.php index f8926c3c7251..280eb9afe611 100644 --- a/app/Http/Controllers/SubscribeController.php +++ b/app/Http/Controllers/SubscribeController.php @@ -26,7 +26,6 @@ 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 @@ public function postSubscribe() 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 @@ public function getVerify($code = null) 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 @@ public function getUnsubscribe($code = null, $subscription = null) 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 @@ public function postManage($code = null) 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'))); } } diff --git a/app/Http/Middleware/SetupAlreadyCompleted.php b/app/Http/Middleware/SetupAlreadyCompleted.php index d8d664ef084a..50bcce5a292a 100644 --- a/app/Http/Middleware/SetupAlreadyCompleted.php +++ b/app/Http/Middleware/SetupAlreadyCompleted.php @@ -14,7 +14,6 @@ use Closure; use Illuminate\Contracts\Config\Repository; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Redirect; /** * This is the setup already completed middelware class. @@ -55,7 +54,7 @@ public function __construct(Repository $config) public function handle(Request $request, Closure $next) { if ($this->config->get('setting.app_name')) { - return Redirect::route('dashboard.index'); + return cachet_route('dashboard'); } return $next($request); diff --git a/app/Http/Middleware/SubscribersConfigured.php b/app/Http/Middleware/SubscribersConfigured.php index d549555f68fc..3069d1edf95e 100644 --- a/app/Http/Middleware/SubscribersConfigured.php +++ b/app/Http/Middleware/SubscribersConfigured.php @@ -13,7 +13,6 @@ use Closure; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Redirect; /** * This is the subscribers configured middleware class. @@ -34,7 +33,7 @@ class SubscribersConfigured public function handle(Request $request, Closure $next) { if (!subscribers_enabled()) { - return Redirect::route('status-page'); + return cachet_route('status-page'); } return $next($request); diff --git a/app/Http/Routes/ApiRoutes.php b/app/Http/Routes/ApiRoutes.php index bb5303db398e..6bc32aa3789c 100644 --- a/app/Http/Routes/ApiRoutes.php +++ b/app/Http/Routes/ApiRoutes.php @@ -29,7 +29,11 @@ class ApiRoutes */ public function map(Registrar $router) { - $router->group(['namespace' => 'Api', 'prefix' => 'api/v1', 'middleware' => ['api']], function (Registrar $router) { + $router->group([ + 'namespace' => 'Api', + 'prefix' => 'api/v1', + 'middleware' => ['api'], + ], function (Registrar $router) { $router->group(['middleware' => ['auth.api']], function (Registrar $router) { $router->get('ping', 'GeneralController@ping'); $router->get('version', 'GeneralController@version'); diff --git a/app/Http/Routes/AuthRoutes.php b/app/Http/Routes/AuthRoutes.php index f61477788e25..0e9fdee5e018 100644 --- a/app/Http/Routes/AuthRoutes.php +++ b/app/Http/Routes/AuthRoutes.php @@ -29,30 +29,35 @@ class AuthRoutes */ public function map(Registrar $router) { - $router->group(['as' => 'auth.', 'middleware' => ['web', 'ready'], 'prefix' => 'auth'], function (Registrar $router) { + $router->group([ + 'middleware' => ['web', 'ready'], + 'prefix' => 'auth', + ], function (Registrar $router) { $router->get('login', [ + 'as' => 'get:auth.login', 'middleware' => 'guest', - 'as' => 'login', 'uses' => 'AuthController@showLogin', ]); $router->post('login', [ + 'as' => 'post:auth.login', 'middleware' => ['guest', 'throttle:10,10'], 'uses' => 'AuthController@postLogin', ]); $router->get('2fa', [ - 'as' => 'two-factor', + 'as' => 'get:auth.two-factor', 'uses' => 'AuthController@showTwoFactorAuth', ]); $router->post('2fa', [ + 'as' => 'post:auth.two-factor', 'middleware' => ['throttle:10,10'], 'uses' => 'AuthController@postTwoFactor', ]); $router->get('logout', [ - 'as' => 'logout', + 'as' => 'get:auth.logout', 'uses' => 'AuthController@logoutAction', 'middleware' => 'auth', ]); diff --git a/app/Http/Routes/Dashboard/ApiRoutes.php b/app/Http/Routes/Dashboard/ApiRoutes.php index 5aeeb4b5672b..6b2567d5c9a8 100644 --- a/app/Http/Routes/Dashboard/ApiRoutes.php +++ b/app/Http/Routes/Dashboard/ApiRoutes.php @@ -33,7 +33,6 @@ public function map(Registrar $router) $router->group([ 'middleware' => ['web', 'auth'], 'namespace' => 'Dashboard', - 'as' => 'dashboard.api.', 'prefix' => 'dashboard/api', ], function (Registrar $router) { $router->get('incidents/templates', 'ApiController@getIncidentTemplate'); diff --git a/app/Http/Routes/Dashboard/BaseRoutes.php b/app/Http/Routes/Dashboard/BaseRoutes.php index 0b82d944e9bc..cdb308f7eee2 100644 --- a/app/Http/Routes/Dashboard/BaseRoutes.php +++ b/app/Http/Routes/Dashboard/BaseRoutes.php @@ -30,12 +30,15 @@ class BaseRoutes */ public function map(Registrar $router) { - $router->group(['middleware' => ['web', 'auth'], 'namespace' => 'Dashboard'], function (Registrar $router) { + $router->group([ + 'middleware' => ['web', 'auth'], + 'namespace' => 'Dashboard', + ], function (Registrar $router) { $router->get('admin', 'DashboardController@redirectAdmin'); - $router->group(['prefix' => 'dashboard', 'as' => 'dashboard.'], function (Registrar $router) { + $router->group(['prefix' => 'dashboard'], function (Registrar $router) { $router->get('/', [ - 'as' => 'index', + 'as' => 'get:dashboard', 'uses' => 'DashboardController@showDashboard', ]); }); diff --git a/app/Http/Routes/Dashboard/ComponentRoutes.php b/app/Http/Routes/Dashboard/ComponentRoutes.php index 21b6bbe04b8b..6cdbcaaadb58 100644 --- a/app/Http/Routes/Dashboard/ComponentRoutes.php +++ b/app/Http/Routes/Dashboard/ComponentRoutes.php @@ -33,39 +33,61 @@ public function map(Registrar $router) $router->group([ 'middleware' => ['web', 'auth'], 'namespace' => 'Dashboard', - 'as' => 'dashboard.components.', 'prefix' => 'dashboard/components', ], function (Registrar $router) { $router->get('/', [ - 'as' => 'index', + 'as' => 'get:dashboard.components', 'uses' => 'ComponentController@showComponents', ]); - $router->get('add', [ - 'as' => 'add', + + $router->get('create', [ + 'as' => 'get:dashboard.components.create', 'uses' => 'ComponentController@showAddComponent', ]); - $router->post('add', 'ComponentController@createComponentAction'); + $router->post('create', [ + 'as' => 'post:dashboard.components.create', + 'uses' => 'ComponentController@createComponentAction', + ]); + $router->get('groups', [ - 'as' => 'groups', + 'as' => 'get:dashboard.components.groups', 'uses' => 'ComponentController@showComponentGroups', ]); - $router->get('groups/add', [ - 'as' => 'groups.add', + + $router->get('groups/create', [ + 'as' => 'get:dashboard.components.groups.create', 'uses' => 'ComponentController@showAddComponentGroup', ]); - $router->get('groups/edit/{component_group}', [ - 'as' => 'groups.edit', + $router->post('groups/create', [ + 'as' => 'post:dashboard.components.groups.create', + 'uses' => 'ComponentController@postAddComponentGroup', + ]); + + $router->get('groups/{component_group}', [ + 'as' => 'get:dashboard.components.groups.edit', 'uses' => 'ComponentController@showEditComponentGroup', ]); - $router->post('groups/edit/{component_group}', 'ComponentController@updateComponentGroupAction'); - $router->delete('groups/{component_group}/delete', 'ComponentController@deleteComponentGroupAction'); - $router->post('groups/add', 'ComponentController@postAddComponentGroup'); - $router->get('{component}/edit', [ - 'as' => 'edit', + $router->post('groups/{component_group}', [ + 'as' => 'post:dashboard.components.groups.edit', + 'uses' => 'ComponentController@updateComponentGroupAction', + ]); + $router->delete('groups/{component_group}', [ + 'as' => 'delete:dashboard.components.groups.delete', + 'uses' => 'ComponentController@deleteComponentGroupAction', + ]); + + $router->get('{component}', [ + 'as' => 'get:dashboard.components.edit', 'uses' => 'ComponentController@showEditComponent', ]); - $router->delete('{component}/delete', 'ComponentController@deleteComponentAction'); - $router->post('{component}/edit', 'ComponentController@updateComponentAction'); + $router->post('{component}', [ + 'as' => 'post:dashboard.components.edit', + 'uses' => 'ComponentController@updateComponentAction', + ]); + $router->delete('{component}', [ + 'as' => 'delete:dashboard.components.delete', + 'uses' => 'ComponentController@deleteComponentAction', + ]); }); } } diff --git a/app/Http/Routes/Dashboard/IncidentRoutes.php b/app/Http/Routes/Dashboard/IncidentRoutes.php index 68fa5ecc10e0..d631f93bb3f4 100644 --- a/app/Http/Routes/Dashboard/IncidentRoutes.php +++ b/app/Http/Routes/Dashboard/IncidentRoutes.php @@ -33,32 +33,43 @@ public function map(Registrar $router) $router->group([ 'middleware' => ['web', 'auth'], 'namespace' => 'Dashboard', - 'as' => 'dashboard.incidents.', 'prefix' => 'dashboard/incidents', ], function (Registrar $router) { $router->get('/', [ - 'as' => 'index', + 'as' => 'get:dashboard.incidents', 'uses' => 'IncidentController@showIncidents', ]); - $router->get('add', [ - 'as' => 'add', + + $router->get('create', [ + 'as' => 'get:dashboard.incidents.create', 'uses' => 'IncidentController@showAddIncident', ]); - $router->post('add', 'IncidentController@createIncidentAction'); - $router->delete('{incident}/delete', [ - 'as' => 'delete', - 'uses' => 'IncidentController@deleteIncidentAction', + $router->post('create', [ + 'as' => 'post:dashboard.incidents.create', + 'uses' => 'IncidentController@createIncidentAction', ]); - $router->get('{incident}/edit', [ - 'as' => 'edit', + + $router->get('{incident}', [ + 'as' => 'get:dashboard.incidents.edit', 'uses' => 'IncidentController@showEditIncidentAction', ]); - $router->get('{incident}/update', [ - 'as' => 'update', + $router->post('{incident}', [ + 'as' => 'post:dashboard.incidents.edit', + 'uses' => 'IncidentController@editIncidentAction', + ]); + $router->delete('{incident}', [ + 'as' => 'delete:dashboard.incidents.delete', + 'uses' => 'IncidentController@deleteIncidentAction', + ]); + + $router->get('{incident}/updates', [ + 'as' => 'get:dashboard.incidents.updates', 'uses' => 'IncidentController@showIncidentUpdateAction', ]); - $router->post('{incident}/edit', 'IncidentController@editIncidentAction'); - $router->post('{incident}/update', 'IncidentController@createIncidentUpdateAction'); + $router->post('{incident}/updates', [ + 'as' => 'post:dashboard.incidents.updates', + 'uses' => 'IncidentController@createIncidentUpdateAction', + ]); }); } } diff --git a/app/Http/Routes/Dashboard/MetricRoutes.php b/app/Http/Routes/Dashboard/MetricRoutes.php index 295a51c574c4..7d59c043e244 100644 --- a/app/Http/Routes/Dashboard/MetricRoutes.php +++ b/app/Http/Routes/Dashboard/MetricRoutes.php @@ -33,24 +33,34 @@ public function map(Registrar $router) $router->group([ 'middleware' => ['web', 'auth'], 'namespace' => 'Dashboard', - 'as' => 'dashboard.metrics.', 'prefix' => 'dashboard/metrics', ], function (Registrar $router) { $router->get('/', [ - 'as' => 'index', + 'as' => 'get:dashboard.metrics', 'uses' => 'MetricController@showMetrics', ]); - $router->get('add', [ - 'as' => 'add', + + $router->get('create', [ + 'as' => 'get:dashboard.metrics.create', 'uses' => 'MetricController@showAddMetric', ]); - $router->post('add', 'MetricController@createMetricAction'); - $router->delete('{metric}/delete', 'MetricController@deleteMetricAction'); - $router->get('{metric}/edit', [ - 'as' => 'edit', + $router->post('create', [ + 'as' => 'post:dashboard.metrics.create', + 'uses' => 'MetricController@createMetricAction', + ]); + + $router->get('{metric}', [ + 'as' => 'get:dashboard.metrics.edit', 'uses' => 'MetricController@showEditMetricAction', ]); - $router->post('{metric}/edit', 'MetricController@editMetricAction'); + $router->post('{metric}', [ + 'as' => 'post:dashboard.metrics.edit', + 'uses' => 'MetricController@editMetricAction', + ]); + $router->delete('{metric}', [ + 'as' => 'delete:dashboard.metrics.delete', + 'uses' => 'MetricController@deleteMetricAction', + ]); }); } } diff --git a/app/Http/Routes/Dashboard/ScheduleRoutes.php b/app/Http/Routes/Dashboard/ScheduleRoutes.php index 4eb29c65a0f8..722ab8a03aa1 100644 --- a/app/Http/Routes/Dashboard/ScheduleRoutes.php +++ b/app/Http/Routes/Dashboard/ScheduleRoutes.php @@ -33,25 +33,32 @@ public function map(Registrar $router) $router->group([ 'middleware' => ['web', 'auth'], 'namespace' => 'Dashboard', - 'as' => 'dashboard.schedule.', 'prefix' => 'dashboard/schedule', ], function (Registrar $router) { $router->get('/', [ - 'as' => 'index', + 'as' => 'get:dashboard.schedule', 'uses' => 'ScheduleController@showIndex', ]); - $router->get('add', [ - 'as' => 'add', + + $router->get('create', [ + 'as' => 'get:dashboard.schedule.create', 'uses' => 'ScheduleController@showAddSchedule', ]); - $router->post('add', 'ScheduleController@addScheduleAction'); - $router->get('{incident}/edit', [ - 'as' => 'edit', + $router->post('create', [ + 'as' => 'post:dashboard.schedule.create', + 'uses' => 'ScheduleController@addScheduleAction', + ]); + + $router->get('{incident}', [ + 'as' => 'get:dashboard.schedule.edit', 'uses' => 'ScheduleController@showEditSchedule', ]); - $router->post('{incident}/edit', 'ScheduleController@editScheduleAction'); - $router->delete('{incident}/delete', [ - 'as' => 'delete', + $router->post('{incident}', [ + 'as' => 'post:dashboard.schedule.edit', + 'uses' => 'ScheduleController@editScheduleAction', + ]); + $router->delete('{incident}', [ + 'as' => 'delete:dashboard.schedule.delete', 'uses' => 'ScheduleController@deleteScheduleAction', ]); }); diff --git a/app/Http/Routes/Dashboard/SettingRoutes.php b/app/Http/Routes/Dashboard/SettingRoutes.php index a48002f11846..c4050236a459 100644 --- a/app/Http/Routes/Dashboard/SettingRoutes.php +++ b/app/Http/Routes/Dashboard/SettingRoutes.php @@ -33,46 +33,49 @@ public function map(Registrar $router) $router->group([ 'middleware' => ['web', 'auth'], 'namespace' => 'Dashboard', - 'as' => 'dashboard.settings.', 'prefix' => 'dashboard/settings', ], function (Registrar $router) { $router->get('setup', [ - 'as' => 'setup', + 'as' => 'get:dashboard.settings.setup', 'uses' => 'SettingsController@showSetupView', ]); $router->get('analytics', [ - 'as' => 'analytics', + 'as' => 'get:dashboard.settings.analytics', 'uses' => 'SettingsController@showAnalyticsView', ]); $router->get('localization', [ - 'as' => 'localization', + 'as' => 'get:dashboard.settings.localization', 'uses' => 'SettingsController@showLocalizationView', ]); $router->get('security', [ - 'as' => 'security', + 'as' => 'get:dashboard.settings.security', 'uses' => 'SettingsController@showSecurityView', ]); $router->get('theme', [ - 'as' => 'theme', + 'as' => 'get:dashboard.settings.theme', 'uses' => 'SettingsController@showThemeView', ]); $router->get('stylesheet', [ - 'as' => 'stylesheet', + 'as' => 'get:dashboard.settings.stylesheet', 'uses' => 'SettingsController@showStylesheetView', ]); $router->get('customization', [ - 'as' => 'customization', + 'as' => 'get:dashboard.settings.customization', 'uses' => 'SettingsController@showCustomizationView', ]); $router->get('credits', [ - 'as' => 'credits', + 'as' => 'get:dashboard.settings.credits', 'uses' => 'SettingsController@showCreditsView', ]); $router->get('log', [ - 'as' => 'log', + 'as' => 'get:dashboard.settings.log', 'uses' => 'SettingsController@showLogView', ]); - $router->post('/', 'SettingsController@postSettings'); + + $router->post('/', [ + 'as' => 'post:dashboard.settings', + 'uses' => 'SettingsController@postSettings', + ]); }); } } diff --git a/app/Http/Routes/Dashboard/SubscriberRoutes.php b/app/Http/Routes/Dashboard/SubscriberRoutes.php index d2e804e0df35..00f37357ce0b 100644 --- a/app/Http/Routes/Dashboard/SubscriberRoutes.php +++ b/app/Http/Routes/Dashboard/SubscriberRoutes.php @@ -33,19 +33,26 @@ public function map(Registrar $router) $router->group([ 'middleware' => ['web', 'auth'], 'namespace' => 'Dashboard', - 'as' => 'dashboard.subscribers.', 'prefix' => 'dashboard/subscribers', ], function (Registrar $router) { $router->get('/', [ - 'as' => 'index', + 'as' => 'get:dashboard.subscribers', 'uses' => 'SubscriberController@showSubscribers', ]); - $router->get('add', [ - 'as' => 'add', + + $router->get('create', [ + 'as' => 'get:dashboard.subscribers.create', 'uses' => 'SubscriberController@showAddSubscriber', ]); - $router->post('add', 'SubscriberController@createSubscriberAction'); - $router->delete('{subscriber}/delete', 'SubscriberController@deleteSubscriberAction'); + $router->post('create', [ + 'as' => 'post:dashboard.subscribers.create', + 'uses' => 'SubscriberController@createSubscriberAction', + ]); + + $router->delete('{subscriber}/delete', [ + 'as' => 'delete:dashbpard.subscribers.delete', + 'uses' => 'SubscriberController@deleteSubscriberAction', + ]); }); } } diff --git a/app/Http/Routes/Dashboard/TeamRoutes.php b/app/Http/Routes/Dashboard/TeamRoutes.php index c7580501b189..db56141fcab6 100644 --- a/app/Http/Routes/Dashboard/TeamRoutes.php +++ b/app/Http/Routes/Dashboard/TeamRoutes.php @@ -33,28 +33,44 @@ public function map(Registrar $router) $router->group([ 'middleware' => ['web', 'auth'], 'namespace' => 'Dashboard', - 'as' => 'dashboard.team.', 'prefix' => 'dashboard/team', ], function (Registrar $router) { $router->get('/', [ - 'as' => 'index', + 'as' => 'get:dashboard.team', 'uses' => 'TeamController@showTeamView', ]); $router->group(['middleware' => 'admin'], function (Registrar $router) { - $router->get('add', [ - 'as' => 'add', + $router->get('create', [ + 'as' => 'get:dashboard.team.create', 'uses' => 'TeamController@showAddTeamMemberView', ]); + $router->post('create', [ + 'as' => 'post:dashboard.team.create', + 'uses' => 'TeamController@postAddUser', + ]); + $router->get('invite', [ - 'as' => 'invite', + 'as' => 'get:dashboard.team.invite', 'uses' => 'TeamController@showInviteTeamMemberView', ]); - $router->get('{user}', ['as' => 'edit', 'uses' => 'TeamController@showTeamMemberView']); - $router->post('add', 'TeamController@postAddUser'); - $router->post('invite', 'TeamController@postInviteUser'); - $router->post('{user}', 'TeamController@postUpdateUser'); - $router->delete('{user}/delete', 'TeamController@deleteUser'); + $router->post('invite', [ + 'as' => 'post:dashboard.team.invite', + 'uses' => 'TeamController@postInviteUser', + ]); + + $router->get('{user}', [ + 'as' => 'get:dashboard.team.edit', + 'uses' => 'TeamController@showTeamMemberView', + ]); + $router->post('{user}', [ + 'as' => 'post::dashboard.team.edit', + 'uses' => 'TeamController@postUpdateUser', + ]); + $router->delete('{user}', [ + 'as' => 'delete:dashboard.team.delete', + 'uses' => 'TeamController@deleteUser', + ]); }); }); } diff --git a/app/Http/Routes/Dashboard/TemplateRoutes.php b/app/Http/Routes/Dashboard/TemplateRoutes.php index 41abd4845c6f..7e41a97e4288 100644 --- a/app/Http/Routes/Dashboard/TemplateRoutes.php +++ b/app/Http/Routes/Dashboard/TemplateRoutes.php @@ -33,24 +33,34 @@ public function map(Registrar $router) $router->group([ 'middleware' => ['web', 'auth'], 'namespace' => 'Dashboard', - 'as' => 'dashboard.templates.', 'prefix' => 'dashboard/templates', ], function (Registrar $router) { $router->get('/', [ - 'as' => 'index', + 'as' => 'get:dashboard.templates', 'uses' => 'IncidentController@showTemplates', ]); - $router->get('add', [ - 'as' => 'add', + + $router->get('create', [ + 'as' => 'get:dashboard.templates.create', 'uses' => 'IncidentController@showAddIncidentTemplate', ]); - $router->post('add', 'IncidentController@createIncidentTemplateAction'); - $router->get('{incident_template}/edit', [ - 'as' => 'edit', + $router->post('create', [ + 'as' => 'post:dashboard.templates.create', + 'uses' => 'IncidentController@createIncidentTemplateAction', + ]); + + $router->get('{incident_template}', [ + 'as' => 'get:dashboard.templates.edit', 'uses' => 'IncidentController@showEditTemplateAction', ]); - $router->post('{incident_template}/edit', 'IncidentController@editTemplateAction'); - $router->delete('{incident_template}/delete', 'IncidentController@deleteTemplateAction'); + $router->post('{incident_template}', [ + 'as' => 'post:dashboard.templates.edit', + 'uses' => 'IncidentController@editTemplateAction', + ]); + $router->delete('{incident_template}', [ + 'as' => 'delete::dashboard.templates.delete', + 'uses' => 'IncidentController@deleteTemplateAction', + ]); }); } } diff --git a/app/Http/Routes/Dashboard/UserRoutes.php b/app/Http/Routes/Dashboard/UserRoutes.php index c54a2ea6e574..6934a4a64113 100644 --- a/app/Http/Routes/Dashboard/UserRoutes.php +++ b/app/Http/Routes/Dashboard/UserRoutes.php @@ -33,15 +33,21 @@ public function map(Registrar $router) $router->group([ 'middleware' => ['web', 'auth'], 'namespace' => 'Dashboard', - 'as' => 'dashboard.user.', 'prefix' => 'dashboard/user', ], function (Registrar $router) { $router->get('/', [ - 'as' => 'user', + 'as' => 'get:dashboard.user', 'uses' => 'UserController@showUser', ]); - $router->post('/', 'UserController@postUser'); - $router->get('{user}/api/regen', 'UserController@regenerateApiKey'); + $router->post('/', [ + 'as' => 'post:dashboard.user', + 'uses' => 'UserController@postUser', + ]); + + $router->get('{user}/api/regen', [ + 'as' => 'get:dashboard.user.api.regen', + 'uses' => 'UserController@regenerateApiKey', + ]); }); } } diff --git a/app/Http/Routes/FeedRoutes.php b/app/Http/Routes/FeedRoutes.php index cad095169b16..b2971c45798d 100644 --- a/app/Http/Routes/FeedRoutes.php +++ b/app/Http/Routes/FeedRoutes.php @@ -29,13 +29,16 @@ class FeedRoutes */ public function map(Registrar $router) { - $router->group(['middleware' => ['web', 'ready'], 'as' => 'feed.'], function (Registrar $router) { + $router->group([ + 'middleware' => ['web', 'ready'], + ], function (Registrar $router) { $router->get('/atom/{component_group?}', [ - 'as' => 'atom', + 'as' => 'get:feed.atom', 'uses' => 'FeedController@atomAction', ]); + $router->get('/rss/{component_group?}', [ - 'as' => 'rss', + 'as' => 'get:feed.rss', 'uses' => 'FeedController@rssAction', ]); }); diff --git a/app/Http/Routes/SetupRoutes.php b/app/Http/Routes/SetupRoutes.php index d2a33515476b..a0ed0249991e 100644 --- a/app/Http/Routes/SetupRoutes.php +++ b/app/Http/Routes/SetupRoutes.php @@ -30,11 +30,29 @@ class SetupRoutes */ public function map(Registrar $router) { - $router->group(['middleware' => ['web', 'setup']], function (Registrar $router) { - $router->get('setup', 'SetupController@getIndex'); - $router->post('setup/step1', 'SetupController@postStep1'); - $router->post('setup/step2', 'SetupController@postStep2'); - $router->post('setup/step3', 'SetupController@postStep3'); + $router->group([ + 'middleware' => ['web', 'setup'], + 'prefix' => 'setup', + ], function (Registrar $router) { + $router->get('/', [ + 'as' => 'get:setup', + 'uses' => 'SetupController@getIndex', + ]); + + $router->post('step1', [ + 'as' => 'post:setup.step1', + 'uses' => 'SetupController@postStep1', + ]); + + $router->post('step2', [ + 'as' => 'post:setup.step2', + 'uses' => 'SetupController@postStep2', + ]); + + $router->post('step3', [ + 'as' => 'post:setup.step3', + 'uses' => 'SetupController@postStep3', + ]); }); } } diff --git a/app/Http/Routes/SignupRoutes.php b/app/Http/Routes/SignupRoutes.php index 8e9d7f466c21..1e0252ccc53c 100644 --- a/app/Http/Routes/SignupRoutes.php +++ b/app/Http/Routes/SignupRoutes.php @@ -29,13 +29,17 @@ class SignupRoutes */ public function map(Registrar $router) { - $router->group(['middleware' => ['web', 'ready', 'guest'], 'as' => 'signup.'], function (Registrar $router) { - $router->get('signup/invite/{code}', [ - 'as' => 'invite', + $router->group([ + 'middleware' => ['web', 'ready', 'guest'], + 'prefix' => 'signup', + ], function (Registrar $router) { + $router->get('invite/{code}', [ + 'as' => 'get:signup.invite', 'uses' => 'SignupController@getSignup', ]); - $router->post('signup/invite/{code}', [ + $router->post('invite/{code}', [ + 'as' => 'post:signup.invite', 'uses' => 'SignupController@postSignup', ]); }); diff --git a/app/Http/Routes/StatusPageRoutes.php b/app/Http/Routes/StatusPageRoutes.php index ede2b7e1b695..d83527398974 100644 --- a/app/Http/Routes/StatusPageRoutes.php +++ b/app/Http/Routes/StatusPageRoutes.php @@ -29,23 +29,28 @@ class StatusPageRoutes */ public function map(Registrar $router) { - $router->group(['middleware' => ['web', 'ready', 'localize']], function (Registrar $router) { + $router->group([ + 'middleware' => ['web', 'ready', 'localize'], + ], function (Registrar $router) { $router->get('/', [ - 'as' => 'status-page', + 'as' => 'get:status-page', 'uses' => 'StatusPageController@showIndex', ]); - $router->get('incident/{incident}', [ - 'as' => 'incident', + $router->get('incidents/{incident}', [ + 'as' => 'get:incident', 'uses' => 'StatusPageController@showIncident', ]); $router->get('metrics/{metric}', [ - 'as' => 'metrics', + 'as' => 'get:metric', 'uses' => 'StatusPageController@getMetrics', ]); - $router->get('component/{component}/shield', 'StatusPageController@showComponentBadge'); + $router->get('component/{component}/shield', [ + 'as' => 'get:component_shield', + 'uses' => 'StatusPageController@showComponentBadge', + ]); }); } } diff --git a/app/Http/Routes/SubscribeRoutes.php b/app/Http/Routes/SubscribeRoutes.php index cc0dc0f2aaef..7eded56f9421 100644 --- a/app/Http/Routes/SubscribeRoutes.php +++ b/app/Http/Routes/SubscribeRoutes.php @@ -29,33 +29,34 @@ class SubscribeRoutes */ public function map(Registrar $router) { - $router->group(['middleware' => ['web', 'ready', 'localize', 'subscribers'], 'as' => 'subscribe.'], function (Registrar $router) { + $router->group([ + 'middleware' => ['web', 'ready', 'localize', 'subscribers'], + ], function (Registrar $router) { $router->get('subscribe', [ - 'as' => 'subscribe', + 'as' => 'get:subscribe', 'uses' => 'SubscribeController@showSubscribe', ]); - $router->post('subscribe', [ + 'as' => 'post:subscribe', 'uses' => 'SubscribeController@postSubscribe', ]); $router->get('subscribe/manage/{code}', [ - 'as' => 'manage', + 'as' => 'get:subscribe.manage', 'uses' => 'SubscribeController@showManage', ]); - $router->post('subscribe/manage/{code}', [ - 'as' => 'manage', + 'as' => 'post:subscribe.manage', 'uses' => 'SubscribeController@postManage', ]); $router->get('subscribe/verify/{code}', [ - 'as' => 'verify', + 'as' => 'get:subscribe.verify', 'uses' => 'SubscribeController@getVerify', ]); $router->get('unsubscribe/{code}/{subscription?}', [ - 'as' => 'unsubscribe', + 'as' => 'get:subscribe.unsubscribe', 'uses' => 'SubscribeController@getUnsubscribe', ]); }); diff --git a/app/Presenters/IncidentPresenter.php b/app/Presenters/IncidentPresenter.php index be2f6d88d846..87ff36fb602d 100644 --- a/app/Presenters/IncidentPresenter.php +++ b/app/Presenters/IncidentPresenter.php @@ -258,7 +258,7 @@ public function latest() */ public function permalink() { - return route('incident', $this->wrappedObject->id); + return cachet_route('incident', [$this->wrappedObject->id]); } /** diff --git a/app/Presenters/IncidentUpdatePresenter.php b/app/Presenters/IncidentUpdatePresenter.php index 84ae8127417b..2a5530e6ca83 100644 --- a/app/Presenters/IncidentUpdatePresenter.php +++ b/app/Presenters/IncidentUpdatePresenter.php @@ -153,7 +153,7 @@ public function human_status() */ public function permalink() { - return route('incident', ['incident' => $this->wrappedObject->incident]).'#update-'.$this->wrappedObject->id; + return cachet_route('incident', [$this->wrappedObject->incident]).'#update-'.$this->wrappedObject->id; } /** diff --git a/app/helpers.php b/app/helpers.php index e8ffd41ed402..0d7f4135a98e 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -139,3 +139,20 @@ function array_numeric_sort(array $array = [], $key = 'order') return $array; } } + +if (!function_exists('cachet_route')) { + /** + * Generate a URL to a named route, which resides in a given domain. + * + * @param string $name + * @param array $parameters + * @param string $method + * @param string $domain + * + * @return string + */ + function cachet_route($name, $parameters = [], $method = 'get', $domain = 'core') + { + return app('url')->route("{$domain}::{$method}:{$name}", $parameters, true); + } +} diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 28d2d60e7116..7c17920f1633 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -10,7 +10,7 @@ -
+ @if(Session::has('error')) @@ -36,7 +36,7 @@

- +
diff --git a/resources/views/dashboard/components/add.blade.php b/resources/views/dashboard/components/add.blade.php index e9e0c62df09e..d423a080c5fe 100644 --- a/resources/views/dashboard/components/add.blade.php +++ b/resources/views/dashboard/components/add.blade.php @@ -14,7 +14,7 @@
@include('dashboard.partials.errors') - +
diff --git a/resources/views/dashboard/components/edit.blade.php b/resources/views/dashboard/components/edit.blade.php index 3f665db219ae..4b57873d724a 100644 --- a/resources/views/dashboard/components/edit.blade.php +++ b/resources/views/dashboard/components/edit.blade.php @@ -14,7 +14,7 @@
@include('dashboard.partials.errors') -
+
@@ -70,7 +70,7 @@
diff --git a/resources/views/dashboard/components/groups/add.blade.php b/resources/views/dashboard/components/groups/add.blade.php index 1c4e989982a9..3fe2219b1c3f 100644 --- a/resources/views/dashboard/components/groups/add.blade.php +++ b/resources/views/dashboard/components/groups/add.blade.php @@ -14,7 +14,7 @@
@include('dashboard.partials.errors') -
+
@@ -40,7 +40,7 @@
diff --git a/resources/views/dashboard/components/groups/edit.blade.php b/resources/views/dashboard/components/groups/edit.blade.php index 7de8f67dbc8f..84f922890e26 100644 --- a/resources/views/dashboard/components/groups/edit.blade.php +++ b/resources/views/dashboard/components/groups/edit.blade.php @@ -40,7 +40,7 @@
diff --git a/resources/views/dashboard/components/groups/index.blade.php b/resources/views/dashboard/components/groups/index.blade.php index 66718cd1bbc8..1e0160b9a708 100644 --- a/resources/views/dashboard/components/groups/index.blade.php +++ b/resources/views/dashboard/components/groups/index.blade.php @@ -10,7 +10,7 @@ {{ trans_choice('dashboard.components.groups.groups', 2) }} - + {{ trans('dashboard.components.groups.add.title') }}
@@ -30,8 +30,8 @@
@empty diff --git a/resources/views/dashboard/components/index.blade.php b/resources/views/dashboard/components/index.blade.php index ae2d81525571..e3db3ceb2fe4 100644 --- a/resources/views/dashboard/components/index.blade.php +++ b/resources/views/dashboard/components/index.blade.php @@ -10,7 +10,7 @@ {{ trans('dashboard.components.components') }} - + {{ trans('dashboard.components.add.title') }}
@@ -35,8 +35,8 @@ @endif
@empty diff --git a/resources/views/dashboard/incidents/add.blade.php b/resources/views/dashboard/incidents/add.blade.php index d925a21a806d..7c1118dcee48 100644 --- a/resources/views/dashboard/incidents/add.blade.php +++ b/resources/views/dashboard/incidents/add.blade.php @@ -128,7 +128,7 @@ diff --git a/resources/views/dashboard/incidents/edit.blade.php b/resources/views/dashboard/incidents/edit.blade.php index 9b419b185b4f..afd1fb4af778 100644 --- a/resources/views/dashboard/incidents/edit.blade.php +++ b/resources/views/dashboard/incidents/edit.blade.php @@ -94,7 +94,7 @@ diff --git a/resources/views/dashboard/incidents/index.blade.php b/resources/views/dashboard/incidents/index.blade.php index 0e20f418dfff..e09f63fbfd16 100644 --- a/resources/views/dashboard/incidents/index.blade.php +++ b/resources/views/dashboard/incidents/index.blade.php @@ -10,7 +10,7 @@ {{ trans('dashboard.incidents.incidents') }} - + {{ trans('dashboard.incidents.add.title') }}
@@ -30,9 +30,9 @@ @endif
@endforeach diff --git a/resources/views/dashboard/incidents/update.blade.php b/resources/views/dashboard/incidents/update.blade.php index 0d4f1c18c4f1..a8275a2f1692 100644 --- a/resources/views/dashboard/incidents/update.blade.php +++ b/resources/views/dashboard/incidents/update.blade.php @@ -54,7 +54,7 @@ diff --git a/resources/views/dashboard/index.blade.php b/resources/views/dashboard/index.blade.php index 333fb17d3de7..f60191e31060 100644 --- a/resources/views/dashboard/index.blade.php +++ b/resources/views/dashboard/index.blade.php @@ -24,7 +24,7 @@ @else @endif @@ -36,7 +36,7 @@
@@ -48,7 +48,7 @@
diff --git a/resources/views/dashboard/metrics/add.blade.php b/resources/views/dashboard/metrics/add.blade.php index 840fd92f2f95..0171418155ba 100644 --- a/resources/views/dashboard/metrics/add.blade.php +++ b/resources/views/dashboard/metrics/add.blade.php @@ -70,7 +70,7 @@ diff --git a/resources/views/dashboard/metrics/edit.blade.php b/resources/views/dashboard/metrics/edit.blade.php index fc5ab321457e..d86513e9ab9d 100644 --- a/resources/views/dashboard/metrics/edit.blade.php +++ b/resources/views/dashboard/metrics/edit.blade.php @@ -73,7 +73,7 @@ diff --git a/resources/views/dashboard/metrics/index.blade.php b/resources/views/dashboard/metrics/index.blade.php index 091c37279930..a4c2ef8be0f2 100644 --- a/resources/views/dashboard/metrics/index.blade.php +++ b/resources/views/dashboard/metrics/index.blade.php @@ -8,7 +8,7 @@ {{ trans('dashboard.metrics.metrics') }} - + {{ trans('dashboard.metrics.add.title') }}
@@ -27,8 +27,8 @@ @endif
@empty diff --git a/resources/views/dashboard/partials/sidebar.blade.php b/resources/views/dashboard/partials/sidebar.blade.php index ee19cd25a580..b1bff1ccfbc2 100644 --- a/resources/views/dashboard/partials/sidebar.blade.php +++ b/resources/views/dashboard/partials/sidebar.blade.php @@ -1,69 +1,69 @@