1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 13:24:03 +00:00
laravel-tips/content/tips/you-can-return-custom-collections-from-eloquent-queries.md
2021-12-03 18:31:27 +01:00

603 B

title tweet_id thread_slug author_username images created_at slug
You can return custom collections from Eloquent queries 1466810189018185728 weekly-thread-2021-48 freekmurze
https://pbs.twimg.com/media/FFRsxnbXsAM2PHo.jpg
2021-12-03T16:42:55+00:00 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