Support the ongoing development of Laravel.io →
Database Eloquent Testing
Last updated 2 years ago.
0

Hey I saw you fixed this, or worked around it, on another forum, but I've had the same issue with factories. Part of the problem is when calling ->each() on a model vs. a collection.

For example you can recreate this with the following:

App\User::find(1)->each(function($u){});

Just make sure when you use a factory and are using each after a make/create call that it is returning a collection vs a single model.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Baadier baadier Joined 12 Nov 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.