You can return custom collections from Eloquent queries

You can return custom collections from Eloquent queries

If you want to have Eloquent return a custom collection class (so you can define methods of your own on it, you can the newCollection method on your model.

More in this excellent post by @timacdonald87 https://timacdonald.me/giving-collections-a-voice/

#laravel #php

We're writing a book, you can get it for free here.