I want to paginate a custom static function.
When using Eloquent goes like this People::paginate(5); and paginates the results.
I need to do the same for this static function People::getOwners();
I want to paginate a custom static function.
When using Eloquent goes like this People::paginate(5); and paginates the results.
I need to do the same for this static function People::getOwners();
Depending on what is going on inside
getOwners(), you could turn it into a query scope. On yourPeoplemodel, add the function:Now,
getOwners()is treated like any other query scope modifier (e.g. where, orderBy, etc.):