forked from projects/fipamo
ro
7024285b70
the first part of the page editing API is working again after porting it over form the old fipamo build. a few changes where made to make the code a big more managable, but the end to end process works for updating pages. the remaining page editing methods will be activated after the rendering engine is in place because that's going to be a pretty siginficant effort. but this is a big step.
77 lines
2 KiB
PHP
77 lines
2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Dash;
|
|
|
|
use App\Interfaces\PageRepositoryInterface;
|
|
use App\Services\AuthService;
|
|
use App\Services\ThemeService;
|
|
use App\Http\Controllers\Controller;
|
|
|
|
class IndexController extends Controller
|
|
{
|
|
protected PageRepositoryInterface $pages;
|
|
protected AuthService $auth;
|
|
protected ThemeService $themes;
|
|
|
|
public function __construct(
|
|
PageRepositoryInterface $pageRepository,
|
|
AuthService $authService,
|
|
ThemeService $themeService,
|
|
) {
|
|
$this->pages = $pageRepository;
|
|
$this->auth = $authService;
|
|
$this->themes = $themeService;
|
|
}
|
|
|
|
public function login()
|
|
{
|
|
if ($this->auth::status()) {
|
|
return redirect('dashboard/start');
|
|
} else {
|
|
return view('back.login', [
|
|
"status" => $this->auth::status(),
|
|
"title" => "Hi!"
|
|
]);
|
|
}
|
|
}
|
|
|
|
public function start()
|
|
{
|
|
$result = [];
|
|
if ($this->auth::status()) {
|
|
$result = $this->pages->getGroup(1, 4);
|
|
}
|
|
return view('back.start', [
|
|
"status" => $this->auth::status(),
|
|
"result" => $result,
|
|
"title" => "Start"
|
|
]);
|
|
}
|
|
|
|
public function book($pageFilter = 'all', $pageNum = 1)
|
|
{
|
|
$result = [];
|
|
if ($this->auth::status()) {
|
|
$result = $this->pages->getGroup($pageNum, 4, $pageFilter);
|
|
}
|
|
return view('back.book', [
|
|
"status" => $this->auth::status(),
|
|
"result" => $result,
|
|
"currentPage" => $pageNum,
|
|
"title" => "Pages"
|
|
]);
|
|
}
|
|
|
|
public function page($mode, $uuid)
|
|
{
|
|
$page = $this->pages->getById($uuid)->first();
|
|
return view('back.page', [
|
|
"status" => $this->auth::status(),
|
|
"mode" => $mode,
|
|
"page" => $page,
|
|
"views" => $this->themes->getCustomViews($page['layout']),
|
|
"title" => $page['title']
|
|
]);
|
|
}
|
|
}
|