Uploading content
This commit is contained in:
33
database/factories/ProductFactory.php
Normal file
33
database/factories/ProductFactory.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user