Are you using $factory(...) or factory(...) in tinker? It should be the second one... ;)
php artisan tinker : Undefined variable: factory on line 1
Hi everyone,
I am working on a project where I use Model Factory. Until now I've always generated random users like this. With no problem. But all of a sudden I get this error message in Artisan Tinker:
$factory(\App\Models\User::class)->create() PHP error: Undefined variable: factory on line 1
I've tried to remove all of my factories and replaced it with the stock User Factory: $factory->define(App\User::class, function (Faker\Generator $faker) { return [ 'name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt(str_random(10)), 'remember_token' => str_random(10), ]; });
With no success..
What could it be?
Please or to participate in this conversation.