File: D:/HostingSpaces/marisrental/boldt.tech/app/Komma/References/ReferenceService.php
<?php
namespace App\Komma\References;
use App\Komma\Base\Service;
use App\Komma\References\Models\Reference;
use Carbon\Carbon;
class ReferenceService 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();
}
private function baseQuery()
{
$operator = \Auth('site')->check() ? '>=' : '=';
return Reference::with('translation', 'images')
->where('active', 1)
->where('secured', $operator, 0)
->orderBy('lft');
}
public function getReferences()
{
return $this->baseQuery()->get();
}
public function getLogoReferences()
{
return $this->baseQuery()
->where('logo_only', 1)
->get();
}
public function getTextReferences()
{
return $this->baseQuery()
->where('logo_only', 0)
->get();
}
}