File: D:/HostingSpaces/Neopoints/momsecurity.be/app/Komma/References/ReferenceService.php
<?php
namespace App\Komma\References;
use App\Komma\Base\Service;
use App\Komma\Pages\PageService;
use App\Komma\References\Models\Reference as ReferenceModel;
use Carbon\Carbon;
class ReferenceService extends Service
{
private $today;
private $pageService;
public function __construct()
{
$this->today = Carbon::now()->addHour();
$this->today = $this->today->format('Y-m-d H:i:s');
$this->pageService = \App::make(PageService::class);
parent::__construct();
}
public function getAllReferences($pagination = false, $itemsPerPage = 9)
{
$references = ReferenceModel::with('translation', 'documents')
->where('active', 1);
if($pagination)
{
$page = $this->pageService->getPageByCodeName('references');
$references = $references->paginate($itemsPerPage);
$references->withPath($page->route);
}
else
{
$references = $references->get();
}
return $references;
}
}