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
This commit is contained in:
parent
d8ee4926b1
commit
7f1654d13b
5 changed files with 19 additions and 28 deletions
|
@ -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;
|
||||
|
|
@ -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');
|
||||
}
|
||||
}
|
|
@ -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;
|
|
@ -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':
|
||||
|
|
|
@ -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;
|
Loading…
Reference in a new issue