-2

In Tinker, App\Models\Project::all(); returns a list of all projects. Now I would like to add additional dummy data with factory(App\Models\Project::class, 10)->create();, but nothing is happening.

What am I doing wrong and how could I debug it?

Andreas
  • 687
  • 2
  • 9
  • 20

1 Answers1

3

In database/factories/ModelFactory.php you have to make sure you define a Model Factory for your Project Model:

$factory->define(App\Project::class, function (Faker\Generator $faker) {
    return [
        'name' => $faker->sentence,
    ];
});

You'll see one in there for the User Model already. https://laravel.com/docs/database-testing#writing-factories