File: D:/HostingSpaces/bomacon/bomacon.nl/app/Machines/MachineService.php
<?php
namespace App\Machines;
use App\Base\Service;
use App\Machines\Models\Machine;
use Carbon\Carbon;
class MachineService 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 getAllMachines($pagination = false, $itemsPerPage = 99)
{
$machinesQuery = Machine::with('translation', 'images')
->where('active', 1)
->orderBy('lft')
->whereHas('translation');
if($pagination)
{
$machines = $machinesQuery->paginate($itemsPerPage);
}
else
{
$machines = $machinesQuery->get();
}
return $machines;
}
}