File: D:/HostingSpaces/SBogers10/otium.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();
}
public function getAllTestimonials($pagination = false, $itemsPerPage = 9)
{
$testimonialsQuery = Testimonial::with('translation')
->where('active', 1)
->orderBy('created_at', 'desc');
if($pagination)
{
$testimonials = $testimonialsQuery->paginate($itemsPerPage);
}
else
{
$testimonials = $testimonialsQuery->get();
}
return $testimonials;
}
}