2024-05-06 21:37:26 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2024-05-13 20:06:05 +02:00
|
|
|
use App\Interfaces\MemberRepositoryInterface;
|
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-13 20:06:05 +02:00
|
|
|
protected $member;
|
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-13 20:06:05 +02:00
|
|
|
MemberRepositoryInterface $memberRepo,
|
2024-05-06 21:37:26 +02:00
|
|
|
) {
|
2024-05-13 20:06:05 +02:00
|
|
|
$this->dash = $dashController;
|
|
|
|
$this->gate = $authController;
|
|
|
|
$this->theme = $themeController;
|
|
|
|
$this->front = $frontController;
|
|
|
|
$this->member = $memberRepo;
|
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-13 20:06:05 +02:00
|
|
|
if ($this->member::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-13 20:06:05 +02:00
|
|
|
if ($this->member::status()) {
|
2024-05-08 20:27:56 +02:00
|
|
|
if (isset($second)) {
|
2024-06-27 01:10:24 +02:00
|
|
|
return $this->theme->getView($third, $fourth);
|
2024-05-08 20:27:56 +02:00
|
|
|
} 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|