This repository has been archived on 2025-12-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

28 lines
904 B
PHP
Raw Permalink Normal View History

2025-11-26 10:05:43 +01:00
<?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)
];
}
}