File: D:/HostingSpaces/SBogers54/csbinstallatietechniek.nl/app/Projects/ProjectService.php
<?php
namespace App\Projects;
use App\Base\Service;
use App\Projects\Models\Project;
use Carbon\Carbon;
final class Projectservice extends Service
{
/**
* Base query for get Project from DB
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
private function baseProjectQuery()
{
return Project::where('active', 1)
->with('translation', 'images')
->orderBy('lft','asc');
}
/**
* Get all Projects
*
* @return \Illuminate\Database\Eloquent\Collection
*/
public function getProjects()
{
return $this->baseProjectQuery()->get();
}
/**
* Get Projects paginated per $amount on a page
*
* @param int $amountPerPage
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
public function getProjectsPaginated($amountPerPage = 12)
{
return $this->baseProjectQuery()->paginate($amountPerPage);
}
}