File: D:/HostingSpaces/SBogers10/finsteps.komma.pro/app/Businesses/BusinessService.php
<?php
namespace App\Businesses;
use App\Base\Service;
use App\Businesses\Models\Business;
use Carbon\Carbon;
class BusinessService 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 getAllBusinesses($pagination = false, $itemsPerPage = 9)
{
$businessesQuery = Business::with('translation', 'images')
->where('active', 1)
->orderBy('lft')
->whereHas('translation');
if($pagination)
{
$businesses = $businessesQuery->paginate($itemsPerPage);
}
else
{
$businesses = $businessesQuery->get();
}
return $businesses;
}
}