-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Description
Hi, this is my first time using this package, and it generated a factory which return an empty array.
The Product model:
namespace App\Models\Product;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
protected $connection = 'sqlite_product';
}The migration:
Schema::connection('sqlite_product')->create('products', function (Blueprint $table) {
$table->tinyIncrements('id')->index();
$table->string('name');
$table->unsignedSmallInteger('price');
$table->boolean('is_public')->default(true);
}After php artisan migrate, and then php artisan make:populated-factory Models\\Product\\Product, there was a message Populated "ProductFactory" factory for "Product" model has been created successfully!
But the ProductFactory return an empty array
use Faker\Generator as Faker;
/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(\App\Models\Product\Product::class, function (Faker $faker) {
return [
];
});I was hoping to generate something like
use Faker\Generator as Faker;
/** @var \Illuminate\Database\Eloquent\Factory $factory */
$factory->define(\App\Models\Product\Product::class, function (Faker $faker) {
return [
'name' => $faker->name,
'price' => $faker->randomNumber(),
'is_public' => $faker->boolean()
];
});I don't know why, my Laravel Framework is 7.19.0, please help, thank you.
Metadata
Metadata
Assignees
Labels
No labels