Laravel - Collections - Custom Collections

If you would like to use a custom Collection object when interacting with a given model, you may define a newCollection method on your model:


Once you have defined a newCollection method, you will receive an instance of your custom collection anytime Eloquent would normally return an Illuminate\Database\Eloquent\Collection instance. If you would like to use a custom collection for every model in your application, you should define the newCollection method on a base model class that is extended by all of your application's models.