siewlon6093
5 months ago
1003
8
Laravel

PHP Notice: Undefined variable: threads in Psy Shell code on line 1

Posted 5 months ago by siewlon6093

$threads->each(function($thread){ factory('App\Reply', 10)->create([ 'thread_id' => $thread->id ]); });

what error??

$factory->define(App\Reply::class, function (Faker $faker) {
    return [
        'thread_id' => function () {
            return factory('App\Thread')->create()->id;
        },

        'user_id' => function () {
            return factory('App\User')->create()->id;
        },
        'body' => $faker->paragraph
    ];
});

Please sign in or create an account to participate in this conversation.