forked from projects/fipamo
ro
177f29802b
plugged in classes for a page repository to handle editing and retrieving page content and an interface class for the controller to talk to to keep the methodoloy seperate from the controller to keep it all clean now whatever changes that need to be made won't bother the controller because it will always be looking for the same functions. super sweet
61 lines
1.5 KiB
PHP
61 lines
1.5 KiB
PHP
<?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($uuid)
|
|
{
|
|
$status = session('handle') !== null ? true : false;
|
|
$result = [];
|
|
if ($status) {
|
|
$result = $this->pages->getPage($pageNum, 4, $pageFilter);
|
|
}
|
|
return view('back.book', [
|
|
"status" => $status,
|
|
"result" => $result,
|
|
"currentPage" => $pageNum,
|
|
"title" => "Pages"
|
|
]);
|
|
}
|
|
}
|