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
develop
ro 2024-05-09 11:24:12 -06:00
parent d8ee4926b1
commit 7f1654d13b
No known key found for this signature in database
GPG Key ID: 29B551CDBD4D3B50
5 changed files with 19 additions and 28 deletions

View File

@ -1,9 +1,8 @@
<?php
namespace App\Http\Controllers\Dash;
namespace App\Http\Controllers;
use Symfony\Component\HttpFoundation\Response;
use App\Http\Controllers\Controller;
use App\Services\AuthService;
use Illuminate\Http\Request;

View File

@ -1,14 +1,13 @@
<?php
namespace App\Http\Controllers\Dash;
namespace App\Http\Controllers;
use App\Interfaces\PageRepositoryInterface;
use App\Services\AuthService;
use App\Services\ThemeService;
use App\Services\SortingService;
use App\Http\Controllers\Controller;
class IndexController extends Controller
class DashController extends Controller
{
protected PageRepositoryInterface $pages;
protected AuthService $auth;
@ -45,12 +44,10 @@ class IndexController extends Controller
return $this->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');
}
}

View File

@ -1,9 +1,8 @@
<?php
namespace App\Http\Controllers\Front;
namespace App\Http\Controllers;
use App\Services\SettingsService;
use App\Http\Controllers\Controller;
use App\Services\AuthService;
use App\Interfaces\PageRepositoryInterface;
use App\Services\SortingService;
@ -11,7 +10,7 @@ use App\Services\AssetService;
use function _\find;
class StartController extends Controller
class FrontController extends Controller
{
protected $settings;
protected $auth;

View File

@ -2,10 +2,6 @@
namespace App\Http\Controllers;
use App\Http\Controllers\Dash\IndexController;
use App\Http\Controllers\Dash\AuthController;
use App\Http\Controllers\Front\StartController;
use App\Http\Controllers\Theming\ThemeController;
use App\Services\AuthService;
use Illuminate\Http\Request;
@ -18,16 +14,16 @@ class RouteController extends Controller
protected $auth;
public function __construct(
IndexController $indexController,
DashController $dashController,
AuthController $authController,
ThemeController $themeController,
StartController $startContoller,
FrontController $frontController,
AuthService $authService,
) {
$this->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':

View File

@ -1,8 +1,7 @@
<?php
namespace App\Http\Controllers\Theming;
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Interfaces\PageRepositoryInterface;
use App\Services\AuthService;
use App\Services\SortingService;