File: D:/HostingSpaces/SBogers10/boldt.komma.pro/app/Komma/FicheMaterials/FicheMaterialService.php
<?php
namespace App\Komma\FicheMaterials;
use App\Komma\Base\Service;
use App\Komma\FicheMaterials\Models\FicheMaterial;
use Carbon\Carbon;
class FicheMaterialService extends Service
{
private $today;
public function __construct()
{
$this->today = Carbon::now()->addHour();
$this->today = $this->today->format('Y-m-d H:i:s');
parent::__construct();
}
public function getAllFiches($pagination = false, $itemsPerPage = 9)
{
$fiches = FicheMaterial::with('translation', 'documents')
->whereHas('documents')
->orderBy('created_at', 'desc');
if($pagination)
{
$fiches = $fiches->paginate($itemsPerPage);
}
else
{
$fiches = $fiches->get();
}
return $fiches;
}
}