2024-02-29 20:00:59 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2024-03-05 20:27:27 +01:00
|
|
|
use App\Interfaces\PageRepositoryInterface;
|
2024-03-01 20:34:36 +01:00
|
|
|
|
2024-02-29 20:00:59 +01:00
|
|
|
class DashController extends Controller
|
|
|
|
{
|
2024-03-05 20:27:27 +01:00
|
|
|
protected PageRepositoryInterface $pages;
|
2024-02-29 20:00:59 +01:00
|
|
|
|
2024-03-01 20:34:36 +01:00
|
|
|
public function __construct(
|
2024-03-05 20:27:27 +01:00
|
|
|
PageRepositoryInterface $pageRepository,
|
2024-03-01 20:34:36 +01:00
|
|
|
) {
|
2024-03-05 20:27:27 +01:00
|
|
|
$this->pages = $pageRepository;
|
2024-02-29 20:00:59 +01:00
|
|
|
}
|
|
|
|
|
2024-03-04 02:50:14 +01:00
|
|
|
public function start()
|
2024-02-29 20:00:59 +01:00
|
|
|
{
|
2024-03-04 00:49:05 +01:00
|
|
|
$status = session('handle') !== null ? true : false;
|
|
|
|
$result = [];
|
|
|
|
if ($status) {
|
2024-03-05 20:27:27 +01:00
|
|
|
$result = $this->pages->getGroup(1, 4);
|
2024-03-04 00:49:05 +01:00
|
|
|
}
|
2024-03-02 01:16:24 +01:00
|
|
|
return view('back.start', [
|
2024-03-04 00:49:05 +01:00
|
|
|
"status" => $status,
|
|
|
|
"result" => $result,
|
2024-03-05 03:06:36 +01:00
|
|
|
"title" => "Start"
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2024-03-05 20:27:27 +01:00
|
|
|
public function book($pageFilter = 'all', $pageNum = 1)
|
|
|
|
{
|
|
|
|
$status = session('handle') !== null ? true : false;
|
|
|
|
$result = [];
|
|
|
|
if ($status) {
|
|
|
|
$result = $this->pages->getGroup($pageNum, 4, $pageFilter);
|
|
|
|
}
|
|
|
|
return view('back.book', [
|
|
|
|
"status" => $status,
|
|
|
|
"result" => $result,
|
|
|
|
"currentPage" => $pageNum,
|
|
|
|
"title" => "Pages"
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2024-03-05 22:49:30 +01:00
|
|
|
public function page($mode, $uuid)
|
2024-03-05 03:06:36 +01:00
|
|
|
{
|
|
|
|
$status = session('handle') !== null ? true : false;
|
2024-03-05 22:49:30 +01:00
|
|
|
$page = $this->pages->getById($uuid)->first();
|
|
|
|
return view('back.page', [
|
|
|
|
"status" => $status,
|
|
|
|
"mode" => $mode,
|
|
|
|
"page" => $page,
|
|
|
|
"title" => 'Editing ' . $page['title']
|
2024-03-02 01:16:24 +01:00
|
|
|
]);
|
2024-02-29 20:00:59 +01:00
|
|
|
}
|
|
|
|
}
|