diff --git a/app/Http/Controllers/DashController.php b/app/Http/Controllers/DashController.php index e227a1f..15af2b6 100644 --- a/app/Http/Controllers/DashController.php +++ b/app/Http/Controllers/DashController.php @@ -2,16 +2,16 @@ namespace App\Http\Controllers; -use App\Services\PaginateService; +use App\Interfaces\PageRepositoryInterface; class DashController extends Controller { - protected $pages; + protected PageRepositoryInterface $pages; public function __construct( - PaginateService $paginateService, + PageRepositoryInterface $pageRepository, ) { - $this->pages = $paginateService; + $this->pages = $pageRepository; } public function start() @@ -19,7 +19,7 @@ class DashController extends Controller $status = session('handle') !== null ? true : false; $result = []; if ($status) { - $result = $this->pages->getPage(1, 4); + $result = $this->pages->getGroup(1, 4); } return view('back.start', [ "status" => $status, @@ -28,7 +28,22 @@ class DashController extends Controller ]); } - public function book($pageFilter = 'all', $pageNum = '1') + 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 = []; diff --git a/app/Interfaces/PageRepositoryInterface.php b/app/Interfaces/PageRepositoryInterface.php new file mode 100644 index 0000000..e8d1b7f --- /dev/null +++ b/app/Interfaces/PageRepositoryInterface.php @@ -0,0 +1,18 @@ +app->bind(SettingsService::class, function ($app) { return new SettingsService(); }); @@ -37,6 +40,6 @@ class FipamoServiceProvider extends ServiceProvider */ public function boot(): void { - // + $this->app->bind(PageRepositoryInterface::class, PageRepository::class); } } diff --git a/app/Repositories/PageRepository.php b/app/Repositories/PageRepository.php new file mode 100644 index 0000000..dc7db39 --- /dev/null +++ b/app/Repositories/PageRepository.php @@ -0,0 +1,53 @@ +content = $contentService; + $this->settings = $settingsService; + $this->paginate = $paginateService; + $this->pages = $this->content->loadAllPages(); + } + + public function getAll() + { + return $this->pages; + } + + public function getById($uuid) + { + } + + public function delete($uuid) + { + } + + public function create(array $page) + { + } + + public function update($uuid, array $page) + { + } + + public function getGroup($num, $limit, $sort = "all") + { + return $this->paginate->getPage($num, $limit, $sort); + } +} diff --git a/config/filesystems.php b/config/filesystems.php index e9d9dbd..63baccc 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -32,28 +32,28 @@ return [ 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), - 'throw' => false, + 'root' => storage_path('app'), + 'throw' => false, ], 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', - 'throw' => false, + 'throw' => false, ], 's3' => [ - 'driver' => 's3', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION'), - 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), - 'endpoint' => env('AWS_ENDPOINT'), + 'driver' => 's3', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION'), + 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), + 'endpoint' => env('AWS_ENDPOINT'), 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), - 'throw' => false, + 'throw' => false, ], ], diff --git a/routes/web.php b/routes/web.php index 9f80fc7..e077743 100644 --- a/routes/web.php +++ b/routes/web.php @@ -28,5 +28,6 @@ Route::post("/login", [AuthController::class, 'enter']); Route::group(['prefix' => 'dashboard'], function () { Route::get("/", [DashController::class, 'start']); Route::get("/pages/{pageFilter?}/{pageNum?}", [DashController::class, 'book']); + Route::get("/page/{uuid}", [DashController::class, 'page']); Route::get("/logout", [AuthController::class, 'exit']); });