I'm looking for a way to paginate this code. I cannot just use ->paginate()
As you see i'm using Eager Loading.
return CTL_Resource::with(['creationCountry' => function($query) {
$query->select('idCountry','name');
}, 'creatorUser' => function($query) {
$query->select('idUser', 'name');
}, 'resourceType' => function($query) {
$query->select(['idResourceType', 'name']);
}, 'tags' => function($query) {
$query->select(['idTag' => 'name']);
}, 'quickTags' => function($query) {
$query->select(['idQuickTag' => 'name']);
}, 'relatedTo' => function($query) {
$query->select(['idRelatedTo' => 'name']);
}])->get();