diff --git a/app/Http/Controllers/RouteController.php b/app/Http/Controllers/RouteController.php index 932018b..3621955 100644 --- a/app/Http/Controllers/RouteController.php +++ b/app/Http/Controllers/RouteController.php @@ -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 (isset($second)) { - return $this->dash->init($second, $third, $fourth); + 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 (isset($second)) { - return $this->theme->getView($third); + if ($this->auth::status()) { + if (isset($second)) { + return $this->theme->getView($third); + } else { + return $this->theme->start(); + } } else { - return $this->theme->start(); + 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; } }