laracasts/TestDummy

Missing argument 2 for Laracasts\TestDummy\FactoriesLoader::{closure}()

Closed this issue · 1 comments

[ErrorException]                                                         
Missing argument 2 for Laracasts\TestDummy\FactoriesLoader::{closure}() 

This error seems to be thrown despite no changes in relevant code.

My factory:

$factory('App\User', function($faker, $overrides) {
    $created = $faker->dateTimeBetween('-2 years', 'now');

    return [
        'username' => $faker->userName,
        'friendly_name' => $faker->firstName,
        'email' => $faker->safeEmail,
        'created_at' => $created,
        'last_login' => $faker->dateTimeBetween($created, 'now'),
    ];
});

My seed:

use Illuminate\Database\Seeder;
use Laracasts\TestDummy\Factory;

class UserTableSeeder extends Seeder {

    public function run()
    {
        DB::table('users')->delete();
        Factory::times(200)->create('App\User');
    }
}

Remove the $overrides argument from your $factory() call.