ro
ad57c29e8d
expanded the auth service class to store member info in the current session so validation is easier also added a token to session data that expires every hour so people won't be logged in forever and take breaks hey, you matter too
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Interfaces\PageRepositoryInterface;
|
|
use App\Services\AuthService;
|
|
|
|
class DashController extends Controller
|
|
{
|
|
protected PageRepositoryInterface $pages;
|
|
protected AuthService $auth;
|
|
|
|
public function __construct(
|
|
PageRepositoryInterface $pageRepository,
|
|
AuthService $authService,
|
|
) {
|
|
$this->pages = $pageRepository;
|
|
$this->auth = $authService;
|
|
}
|
|
|
|
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,
|
|
"title" => 'Editing ' . $page['title']
|
|
]);
|
|
}
|
|
}
|