Replaced Moment with Carbon #84
6 changed files with 111 additions and 21 deletions
|
@ -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 = [];
|
||||
|
|
18
app/Interfaces/PageRepositoryInterface.php
Normal file
18
app/Interfaces/PageRepositoryInterface.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace App\Interfaces;
|
||||
|
||||
interface PageRepositoryInterface
|
||||
{
|
||||
public function getAll();
|
||||
|
||||
public function getByID($uuid);
|
||||
|
||||
public function delete($uuid);
|
||||
|
||||
public function create(array $page);
|
||||
|
||||
public function update($uuid, array $page);
|
||||
|
||||
public function getGroup($num, $limit, $filter);
|
||||
}
|
|
@ -3,6 +3,8 @@
|
|||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Repositories\PageRepository;
|
||||
use App\Interfaces\PageRepositoryInterface;
|
||||
use App\Services\SettingsService;
|
||||
use App\Services\AuthService;
|
||||
use App\Services\ContentService;
|
||||
|
@ -15,6 +17,7 @@ class FipamoServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//services
|
||||
$this->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);
|
||||
}
|
||||
}
|
||||
|
|
53
app/Repositories/PageRepository.php
Normal file
53
app/Repositories/PageRepository.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Interfaces\PageRepositoryInterface;
|
||||
use App\Services\SettingsService;
|
||||
use App\Services\ContentService;
|
||||
use App\Services\PaginateService;
|
||||
|
||||
class PageRepository implements PageRepositoryInterface
|
||||
{
|
||||
protected $content;
|
||||
protected $setttings;
|
||||
protected $paginate;
|
||||
protected $pages;
|
||||
|
||||
public function __construct(
|
||||
ContentService $contentService,
|
||||
SettingsService $settingsService,
|
||||
PaginateService $paginateService
|
||||
) {
|
||||
$this->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);
|
||||
}
|
||||
}
|
|
@ -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,
|
||||
],
|
||||
|
||||
],
|
||||
|
|
|
@ -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']);
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue