fipamo/app/Http/Controllers/DashController.php

58 lines
1.5 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers;
use App\Interfaces\PageRepositoryInterface;
class DashController extends Controller
{
protected PageRepositoryInterface $pages;
public function __construct(
PageRepositoryInterface $pageRepository,
) {
$this->pages = $pageRepository;
}
public function start()
{
$status = session('handle') !== null ? true : false;
$result = [];
if ($status) {
$result = $this->pages->getGroup(1, 4);
}
return view('back.start', [
"status" => $status,
"result" => $result,
"title" => "Start"
]);
}
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"
]);
}
public function page($mode, $uuid)
{
$status = session('handle') !== null ? true : false;
$page = $this->pages->getById($uuid)->first();
return view('back.page', [
"status" => $status,
"mode" => $mode,
"page" => $page,
"title" => 'Editing ' . $page['title']
]);
}
}