From 7f1654d13bae69b620acc4ed10e31e072be0cff4 Mon Sep 17 00:00:00 2001 From: ro Date: Thu, 9 May 2024 11:24:12 -0600 Subject: [PATCH] controller reorganization cleaned up the controller directory and renamed files to more approriate names. made the appropriate changes to RouteController as well as tweaking the routing so it's simpler and easier to follow --- .../Controllers/{Dash => }/AuthController.php | 3 +-- ...IndexController.php => DashController.php} | 17 ++++++++++------- ...tartController.php => FrontController.php} | 5 ++--- app/Http/Controllers/RouteController.php | 19 +++++-------------- .../{Theming => }/ThemeController.php | 3 +-- 5 files changed, 19 insertions(+), 28 deletions(-) rename app/Http/Controllers/{Dash => }/AuthController.php (94%) rename app/Http/Controllers/{Dash/IndexController.php => DashController.php} (92%) rename app/Http/Controllers/{Front/StartController.php => FrontController.php} (96%) rename app/Http/Controllers/{Theming => }/ThemeController.php (97%) diff --git a/app/Http/Controllers/Dash/AuthController.php b/app/Http/Controllers/AuthController.php similarity index 94% rename from app/Http/Controllers/Dash/AuthController.php rename to app/Http/Controllers/AuthController.php index ea333d9..74978e4 100644 --- a/app/Http/Controllers/Dash/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -1,9 +1,8 @@ page($third, $fourth); break; case 'logout': - session()->flush(); - return redirect()->intended('dashboard'); + return $this->logout(); break; default: return $this->start(); - break; } } @@ -58,7 +55,7 @@ class IndexController extends Controller public function login() { if ($this->auth::status()) { - return redirect('dashboard/start'); + return redirect('dashboard'); } else { return view('back.login', [ "status" => $this->auth::status(), @@ -121,4 +118,10 @@ class IndexController extends Controller { return view('back.settings', $this->sort->settings()); } + + public function logout() + { + session()->flush(); + return redirect()->intended('dashboard'); + } } diff --git a/app/Http/Controllers/Front/StartController.php b/app/Http/Controllers/FrontController.php similarity index 96% rename from app/Http/Controllers/Front/StartController.php rename to app/Http/Controllers/FrontController.php index c142175..4233e73 100644 --- a/app/Http/Controllers/Front/StartController.php +++ b/app/Http/Controllers/FrontController.php @@ -1,9 +1,8 @@ dash = $indexController; + $this->dash = $dashController; $this->gate = $authController; $this->theme = $themeController; - $this->front = $startContoller; + $this->front = $frontController; $this->auth = $authService; } @@ -37,11 +33,7 @@ class RouteController extends Controller switch ($first) { case 'dashboard': if ($this->auth::status()) { - if (isset($second)) { - return $this->dash->init($second, $third, $fourth); - } else { - return $this->dash->start(); - } + return $this->dash->init($second, $third, $fourth); } else { return $this->dash->login(); } @@ -56,7 +48,6 @@ class RouteController extends Controller } else { return $this->dash->login(); } - break; case 'tags': case 'archives': diff --git a/app/Http/Controllers/Theming/ThemeController.php b/app/Http/Controllers/ThemeController.php similarity index 97% rename from app/Http/Controllers/Theming/ThemeController.php rename to app/Http/Controllers/ThemeController.php index f354c64..82a518a 100644 --- a/app/Http/Controllers/Theming/ThemeController.php +++ b/app/Http/Controllers/ThemeController.php @@ -1,8 +1,7 @@