mardi 12 mars 2019

Symfony\Component\Debug\Exception\FatalThrowableError

i'm trying to seed data to database using laravel.

this is my factory model

$factory->define(App\product::class, function (Faker\Generator $faker) {
return [
    'name' => $faker->name,
    'description' => $faker->description,
    'price' =>$faker->price,
    'image' => $faker->image,
    'value' => $faker->value,
    'category_id' => $faker->category_id,
    'is_voucher' => $faker->is_voucher,
    'voucher_id' => $faker->voucher_id,

];

});

in the producttableseed

public function run()
{
 $product = factory(product::class, 10)->create();}

and when i run php artisan db:seed i get this error

Symfony\Component\Debug\Exception\FatalThrowableError : Argument 1 passed to Illuminate\Database\Eloquent\Factory::{closure}() must be an instance of Faker\Generator\Generator, instance of Faker\Generator given



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire