diff --git a/app/Http/Controllers/Dash/IndexController.php b/app/Http/Controllers/Dash/IndexController.php index 09563ca..9bd251a 100644 --- a/app/Http/Controllers/Dash/IndexController.php +++ b/app/Http/Controllers/Dash/IndexController.php @@ -27,6 +27,34 @@ class IndexController extends Controller $this->sort = $sortingService; } + public function init($second, $third, $fourth) + { + switch ($second) { + case 'settings': + return $this->settings(); + break; + case 'navigation': + return $this->navigavtion(); + break; + case 'pages': + ($third == null) ? $third = 'all' : $third = $third; + ($fourth == null) ? $fourth = 1 : $fourth = $fourth; + return $this->book($third, $fourth); + break; + case 'page': + return $this->page($third, $fourth); + break; + case 'logout': + session()->flush(); + return redirect()->intended('dashboard'); + break; + default: + return $this->start(); + + break; + } + } + public function login() { if ($this->auth::status()) { diff --git a/app/Http/Controllers/Front/StartController.php b/app/Http/Controllers/Front/StartController.php index a0c5ddf..9f95a7e 100644 --- a/app/Http/Controllers/Front/StartController.php +++ b/app/Http/Controllers/Front/StartController.php @@ -2,21 +2,35 @@ namespace App\Http\Controllers\Front; +use App\Services\SettingsService; use App\Http\Controllers\Controller; +use App\Services\AuthService; class StartController extends Controller { protected $settings; + protected $auth; - public function __construct() + public function __construct(SettingsService $settingsService, AuthService $authService) { + $this->settings = $settingsService; + $this->auth = $authService; } - public function index() + public function index($first = 00, $second = 00, $third = 00) { + $global = $this->settings->getGlobal(); //check if configs are present if (file_exists(env('FOLKS_PATH')) && file_exists(env('SETTINGS_PATH'))) { - return response()->file('../public/index.html'); + if ($global['dynamicRender'] == 'true') { + if (is_numeric($first)) { + dd('index'); + } else { + dd('pages'); + } + } else { + return response()->file('../public/index.html'); + } } else { return view('back.init', ["status" => false, "title" => "Set Up"]); } diff --git a/app/Http/Controllers/RouteController.php b/app/Http/Controllers/RouteController.php new file mode 100644 index 0000000..94787ec --- /dev/null +++ b/app/Http/Controllers/RouteController.php @@ -0,0 +1,61 @@ +dash = $indexController; + $this->auth = $authController; + $this->theme = $themeController; + } + + 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; + default: + dd('$first' . $first); + break; + } + } else { + dd('index'); + } + } + + public function post(Request $request) + { + switch ($request->path()) { + case 'login': + return $this->auth->enter($request); + break; + } + } +} diff --git a/content/themes/fipamo-default-v2/assets/css/frame.css b/content/themes/fipamo-default-v2/assets/css/frame.css index 9e23128..89c3d88 100644 --- a/content/themes/fipamo-default-v2/assets/css/frame.css +++ b/content/themes/fipamo-default-v2/assets/css/frame.css @@ -178,7 +178,6 @@ main > section { display: grid; grid-template-columns: 50% 50%; padding: 0 10%; - max-width: 1000px; color: var(--primary); } diff --git a/routes/web.php b/routes/web.php index 3a2df2a..592cf28 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,10 +1,7 @@ 'dashboard', 'middleware' => 'member.check'], function () { - Route::get("/start", [IndexController::class, 'start'])->name('start'); - Route::get("/pages/{pageFilter?}/{pageNum?}", [IndexController::class, 'book']); - Route::get("/page/{mode}/{uuid}", [IndexController::class, 'page']); - Route::get("/settings", [IndexController::class, 'settings']); - Route::get("/navigation", [IndexController::class, 'navigation']); - Route::get("/logout", [AuthController::class, 'exit']); -}); - -//theme kit -Route::group(['prefix' => 'theme', 'middleware' => 'member.check'], function () { - Route::get("/", [ThemeController::class, 'start']); - Route::get("/view/{view?}", [ThemeController::class, 'getView']); -}); +//routing needs a bit more nuance, so requests are sent to a controller to sort traffic +Route::get("/{first?}/{second?}/{third?}/{four?}", [RouteController::class, 'get']); +Route::post("/{first?}/{second?}/{third?}", [RouteController::class, 'post']);