Add products module #46
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use App\Models\Product;
|
||||
use App\Models\ProductCategory;
|
||||
use App\Models\Unit;
|
||||
|
||||
class ProductFactory extends Factory
|
||||
{
|
||||
protected $model = Product::class;
|
||||
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'title' => $this->faker->words(3, true),
|
||||
'description' => $this->faker->optional()->paragraph(),
|
||||
'notes' => $this->faker->optional()->sentence(),
|
||||
'vendor_url' => $this->faker->optional()->url(),
|
||||
'category_id' => ProductCategory::factory(),
|
||||
'unit_id' => Unit::factory(), // Neue Einheit
|
||||
'price' => $this->faker->optional()->randomFloat(2, 10, 1000),
|
||||
'margin' => $this->faker->randomFloat(2, 0.1, 0.5),
|
||||
'image' => $this->faker->optional()->imageUrl(640, 480, 'products', true)
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user