34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Str;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Product>
|
|
*/
|
|
class ProductFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => fake()->word() . ' ' . fake()->randomNumber(),
|
|
'description' => fake()->sentence(),
|
|
'price' => fake()->randomFloat(2, 1, 1000),
|
|
'stock' => fake()->numberBetween(0, 500),
|
|
'category' => fake()->randomElement(['Electronics', 'Clothing', 'Books', 'Home', 'Toys', 'Sports']),
|
|
'brand' => fake()->company(),
|
|
'sku' => strtoupper(Str::random(10)),
|
|
'weight' => fake()->randomFloat(2, 0.1, 50),
|
|
'status' => fake()->randomElement(['available', 'out_of_stock', 'discontinued']),
|
|
'order' => fake()->numberBetween(1, 100),
|
|
];
|
|
}
|
|
}
|