forked from projects/fipamo
ro
cb99c44a33
html page rendering works, so the next step was to get dynamic page rendering up and running, meaning instead of pages being exported to html, they are instead rendered on the fly when the corresponding URL is hit. the StartController that handles page routing needs to be organized a bit better as there is some confusion between index and regular page files so it's clear where requests are going and what is the expected response
67 lines
1.9 KiB
PHP
67 lines
1.9 KiB
PHP
<?php
|
|
|
|
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 Illuminate\Http\Request;
|
|
|
|
class RouteController extends Controller
|
|
{
|
|
protected $dash;
|
|
protected $auth;
|
|
protected $theme;
|
|
protected $front;
|
|
|
|
public function __construct(
|
|
IndexController $indexController,
|
|
AuthController $authController,
|
|
ThemeController $themeController,
|
|
StartController $startContoller,
|
|
) {
|
|
$this->dash = $indexController;
|
|
$this->auth = $authController;
|
|
$this->theme = $themeController;
|
|
$this->front = $startContoller;
|
|
}
|
|
|
|
public function get($first = null, $second = null, $third = null, $fourth = null)
|
|
{
|
|
if (isset($first) && !is_numeric($first)) {
|
|
switch ($first) {
|
|
case 'dashboard':
|
|
if (isset($second)) {
|
|
return $this->dash->init($second, $third, $fourth);
|
|
} else {
|
|
return $this->dash->login();
|
|
}
|
|
break;
|
|
case 'theme':
|
|
if (isset($second)) {
|
|
return $this->theme->getView($third);
|
|
} else {
|
|
return $this->theme->start();
|
|
}
|
|
break;
|
|
case 'tags':
|
|
case 'archives':
|
|
return $this->front->page($first, $second, $third);
|
|
break;
|
|
}
|
|
} else {
|
|
return $this->front->index($first, $second, $third);
|
|
}
|
|
}
|
|
|
|
public function post(Request $request)
|
|
{
|
|
switch ($request->path()) {
|
|
case 'login':
|
|
return $this->auth->enter($request);
|
|
break;
|
|
}
|
|
}
|
|
}
|