Tim MacDonald demonstrates how you can add logic to a custom collection.

Laravel collections have become an essential part of my codebases and I couldn't imagine working without them. I have found giving collections the voice of the problem domain makes for a much nicer API when compared to the generic collection methods.

https://timacdonald.me/giving-collections-a-voice/