Skip to content

Creating an empty collection of Eloquent model #32850

Answered by hailwood
michalkogut asked this question in General
Discussion options

You must be logged in to vote

collect specifically returns an instance of Illuminate\Support\Collection.
You want an instance of Illuminate\Database\Eloquent\Collection.

So just $collection = new \Illuminate\Database\Eloquent\Collection();

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by michalkogut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants