File: D:/HostingSpaces/SBogers10/beat-the-barn.komma.nl/app/Testimonials/TestimonialService.php
<?php
namespace App\Testimonials;
use App\Base\Service;
use App\Testimonials\Models\Testimonial;
use Carbon\Carbon;
final class TestimonialService 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()
{
return Testimonial::with('translation')
->where('active', 1)
->orderBy('created_at','desc');
}
public function getAll()
{
return $this->baseQuery()->get();
}
public function getForEducation() {
return $this->baseQuery()
->where('type',TestimonialTypes::EDUCATION)
->get();
}
public function getForCoaching() {
return $this->baseQuery()
->where('type',TestimonialTypes::COACHING)
->get();
}
public function getForHome() {
return $this->baseQuery()
// TODO: We need to take not just 4, but we have to choose wich ones some how.
->where('show_on_homepage',1)
->get();
}
}