Reputation: 51
I am Using Laravel 5.6, in the ProductFactory I get this error: Undefined variable $factory
<?php
use Faker\Generator as Faker;
$factory->define(App\Product::class, function (Faker $faker) {
return [
//
];
});
Upvotes: 0
Views: 3311
Reputation: 494
i fixed that with adding this line:
/** @var \Illuminate\Database\Eloquent\Factory $factory */
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use Faker\Generator;
use App\Customer;
$factory->define(Customer::class, function (Generator $faker) {
return [ 'email' => $faker->unique()->safeEmail ];
});
Upvotes: 7