route controller auth checking
there was no auth checking for dashboard and theme routing, so that's been added
This commit is contained in:
parent
b6425e2c07
commit
bd25c0b104
1 changed files with 21 additions and 8 deletions
|
@ -6,25 +6,29 @@ 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;
|
||||
|
||||
class RouteController extends Controller
|
||||
{
|
||||
protected $dash;
|
||||
protected $auth;
|
||||
protected $gate;
|
||||
protected $theme;
|
||||
protected $front;
|
||||
protected $auth;
|
||||
|
||||
public function __construct(
|
||||
IndexController $indexController,
|
||||
AuthController $authController,
|
||||
ThemeController $themeController,
|
||||
StartController $startContoller,
|
||||
AuthService $authService,
|
||||
) {
|
||||
$this->dash = $indexController;
|
||||
$this->auth = $authController;
|
||||
$this->gate = $authController;
|
||||
$this->theme = $themeController;
|
||||
$this->front = $startContoller;
|
||||
$this->auth = $authService;
|
||||
}
|
||||
|
||||
public function get($first = null, $second = null, $third = null, $fourth = null)
|
||||
|
@ -32,18 +36,27 @@ class RouteController extends Controller
|
|||
if (isset($first) && !is_numeric($first)) {
|
||||
switch ($first) {
|
||||
case 'dashboard':
|
||||
if ($this->auth::status()) {
|
||||
if (isset($second)) {
|
||||
return $this->dash->init($second, $third, $fourth);
|
||||
} else {
|
||||
return $this->dash->start();
|
||||
}
|
||||
} else {
|
||||
return $this->dash->login();
|
||||
}
|
||||
break;
|
||||
case 'theme':
|
||||
if ($this->auth::status()) {
|
||||
if (isset($second)) {
|
||||
return $this->theme->getView($third);
|
||||
} else {
|
||||
return $this->theme->start();
|
||||
}
|
||||
} else {
|
||||
return $this->dash->login();
|
||||
}
|
||||
|
||||
break;
|
||||
case 'tags':
|
||||
case 'archives':
|
||||
|
@ -59,7 +72,7 @@ class RouteController extends Controller
|
|||
{
|
||||
switch ($request->path()) {
|
||||
case 'login':
|
||||
return $this->auth->enter($request);
|
||||
return $this->gate->enter($request);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue