2024-05-06 21:37:26 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2024-05-08 20:27:56 +02:00
|
|
|
use App\Services\AuthService;
|
2024-05-06 21:37:26 +02:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
class RouteController extends Controller
|
|
|
|
{
|
|
|
|
protected $dash;
|
2024-05-08 20:27:56 +02:00
|
|
|
protected $gate;
|
2024-05-06 21:37:26 +02:00
|
|
|
protected $theme;
|
2024-05-06 23:09:24 +02:00
|
|
|
protected $front;
|
2024-05-08 20:27:56 +02:00
|
|
|
protected $auth;
|
2024-05-06 21:37:26 +02:00
|
|
|
|
|
|
|
public function __construct(
|
2024-05-09 19:24:12 +02:00
|
|
|
DashController $dashController,
|
2024-05-06 21:37:26 +02:00
|
|
|
AuthController $authController,
|
|
|
|
ThemeController $themeController,
|
2024-05-09 19:24:12 +02:00
|
|
|
FrontController $frontController,
|
2024-05-08 20:27:56 +02:00
|
|
|
AuthService $authService,
|
2024-05-06 21:37:26 +02:00
|
|
|
) {
|
2024-05-09 19:24:12 +02:00
|
|
|
$this->dash = $dashController;
|
2024-05-08 20:27:56 +02:00
|
|
|
$this->gate = $authController;
|
2024-05-06 21:37:26 +02:00
|
|
|
$this->theme = $themeController;
|
2024-05-09 19:24:12 +02:00
|
|
|
$this->front = $frontController;
|
2024-05-08 20:27:56 +02:00
|
|
|
$this->auth = $authService;
|
2024-05-06 21:37:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function get($first = null, $second = null, $third = null, $fourth = null)
|
|
|
|
{
|
|
|
|
if (isset($first) && !is_numeric($first)) {
|
|
|
|
switch ($first) {
|
|
|
|
case 'dashboard':
|
2024-05-08 20:27:56 +02:00
|
|
|
if ($this->auth::status()) {
|
2024-05-09 19:24:12 +02:00
|
|
|
return $this->dash->init($second, $third, $fourth);
|
2024-05-06 21:37:26 +02:00
|
|
|
} else {
|
|
|
|
return $this->dash->login();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'theme':
|
2024-05-08 20:27:56 +02:00
|
|
|
if ($this->auth::status()) {
|
|
|
|
if (isset($second)) {
|
|
|
|
return $this->theme->getView($third);
|
|
|
|
} else {
|
|
|
|
return $this->theme->start();
|
|
|
|
}
|
2024-05-06 21:37:26 +02:00
|
|
|
} else {
|
2024-05-08 20:27:56 +02:00
|
|
|
return $this->dash->login();
|
2024-05-06 21:37:26 +02:00
|
|
|
}
|
|
|
|
break;
|
2024-05-06 23:09:24 +02:00
|
|
|
case 'tags':
|
|
|
|
case 'archives':
|
|
|
|
return $this->front->page($first, $second, $third);
|
2024-05-06 21:37:26 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
2024-05-06 23:09:24 +02:00
|
|
|
return $this->front->index($first, $second, $third);
|
2024-05-06 21:37:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function post(Request $request)
|
|
|
|
{
|
|
|
|
switch ($request->path()) {
|
|
|
|
case 'login':
|
2024-05-08 20:27:56 +02:00
|
|
|
return $this->gate->enter($request);
|
2024-05-06 21:37:26 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|