Add products module #46

This commit is contained in:
2025-11-26 10:05:43 +01:00
parent 155f0d3525
commit 83dd8e9ecb
21 changed files with 607 additions and 50 deletions
+28
View File
@@ -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)
];
}
}