From 4b16a3e403b45cddf501fb8fc614856f1ff0377d Mon Sep 17 00:00:00 2001 From: SevaCode Date: Mon, 3 Feb 2020 18:56:08 +0300 Subject: [PATCH] Change a routing from action(TicketsController@...) to route(Setting::grab('main_route')...) It need to use modified TicketsController. --- src/Controllers/InstallController.php | 2 +- src/Controllers/TicketsController.php | 2 +- src/Middleware/IsAdminMiddleware.php | 3 ++- src/Middleware/IsAgentMiddleware.php | 3 ++- src/Middleware/ResAccessMiddleware.php | 2 +- src/Views/bootstrap3/shared/nav.blade.php | 8 ++++---- src/Views/bootstrap4/shared/nav.blade.php | 8 ++++---- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Controllers/InstallController.php b/src/Controllers/InstallController.php index afcc74ff..40300e8e 100644 --- a/src/Controllers/InstallController.php +++ b/src/Controllers/InstallController.php @@ -276,6 +276,6 @@ public function demoDataSeeder() $seeder->run(); session()->flash('status', 'Demo tickets, users, and agents are seeded!'); - return redirect()->action('\Kordy\Ticketit\Controllers\TicketsController@index'); + return redirect()->route(Setting::grab('main_route') . '.index'); } } diff --git a/src/Controllers/TicketsController.php b/src/Controllers/TicketsController.php index 2d7d093a..d7ecb68e 100644 --- a/src/Controllers/TicketsController.php +++ b/src/Controllers/TicketsController.php @@ -232,7 +232,7 @@ public function store(Request $request) session()->flash('status', trans('ticketit::lang.the-ticket-has-been-created')); - return redirect()->action('\Kordy\Ticketit\Controllers\TicketsController@index'); + return redirect()->route(Setting::grab('main_route') . '.index'); } /** diff --git a/src/Middleware/IsAdminMiddleware.php b/src/Middleware/IsAdminMiddleware.php index 6eec5f32..c32216f2 100644 --- a/src/Middleware/IsAdminMiddleware.php +++ b/src/Middleware/IsAdminMiddleware.php @@ -4,6 +4,7 @@ use Closure; use Kordy\Ticketit\Models\Agent; +use Kordy\Ticketit\Models\Setting; class IsAdminMiddleware { @@ -21,7 +22,7 @@ public function handle($request, Closure $next) return $next($request); } - return redirect()->action('\Kordy\Ticketit\Controllers\TicketsController@index') + return redirect()->route(Setting::grab('main_route') . '.index') ->with('warning', trans('ticketit::lang.you-are-not-permitted-to-access')); } } diff --git a/src/Middleware/IsAgentMiddleware.php b/src/Middleware/IsAgentMiddleware.php index c902122b..823213cc 100644 --- a/src/Middleware/IsAgentMiddleware.php +++ b/src/Middleware/IsAgentMiddleware.php @@ -4,6 +4,7 @@ use Closure; use Kordy\Ticketit\Models\Agent; +use Kordy\Ticketit\Models\Setting; class IsAgentMiddleware { @@ -21,7 +22,7 @@ public function handle($request, Closure $next) return $next($request); } - return redirect()->action('\Kordy\Ticketit\Controllers\TicketsController@index') + return redirect()->route(Setting::grab('main_route'). '.index') ->with('warning', trans('ticketit::lang.you-are-not-permitted-to-access')); } } diff --git a/src/Middleware/ResAccessMiddleware.php b/src/Middleware/ResAccessMiddleware.php index 1b971360..3ca583f1 100644 --- a/src/Middleware/ResAccessMiddleware.php +++ b/src/Middleware/ResAccessMiddleware.php @@ -54,7 +54,7 @@ public function handle($request, Closure $next) return $next($request); } - return redirect()->action('\Kordy\Ticketit\Controllers\TicketsController@index') + return redirect()->route(Setting::grab('main_route') . '.index') ->with('warning', trans('ticketit::lang.you-are-not-permitted-to-access')); } } diff --git a/src/Views/bootstrap3/shared/nav.blade.php b/src/Views/bootstrap3/shared/nav.blade.php index ebfed7c9..0d62194a 100644 --- a/src/Views/bootstrap3/shared/nav.blade.php +++ b/src/Views/bootstrap3/shared/nav.blade.php @@ -1,8 +1,8 @@