Martin, if you're still out there... :)
use App\Models\Fees\UsersSubscription;
use App\User;
use Faker\Generator as Faker;
use Illuminate\Support\Str;
$factory->define(UsersSubscription::class, function (Faker $faker) {
return [
'user_id' => User::Factory(),
'fee_id' => Fee::Factory(),
'active' => '1',
'renew' => '1',
'tcs_version' => '1',
'existing_customer' => 1
];
});
My factories are 7.x style now. But when I do this...
$user = factory(User::class)
->create()
->each(function ($u) {
$u->usersSubscription()->save(factory(UsersSubscription::class)->make());
});
I get this
BadMethodCallException : Call to undefined method App\User::Factory()
...but it works if I do this...
$user = factory(User::class)
->create();
I should have been a lumberjack...