I have a query like this:
$results = User::where('gender', 'male')
->get();
Is there a way that I can call a custom function on this query, like:
$results = User::where('gender', 'male')
->get()
->split();
Where split()
would be the following function:
public function split() {
return array_chunk($results->toArray(), 10);
}
How would I implement something like this? Where would the function go?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/28ZbjWL
via IFTTT
Aucun commentaire:
Enregistrer un commentaire