Various fixes for DB seeding

This commit is contained in:
2025-12-04 22:37:16 +01:00
parent 0200c38f30
commit b7a880d66a
12 changed files with 71 additions and 75 deletions
+3 -1
View File
@@ -11,13 +11,15 @@ public function definition(): array
{
$isSection = rand(0, 10) > 7;
$unit = Unit::where('name', $this->faker->randomElement(['Stück', 'Stunden', 'Tage', 'pauschal']))->first();
return [
'position' => $this->faker->numberBetween(1, 10) + ($isSection ? 0.5 : 0),
'is_section' => $isSection,
'title' => $this->faker->words(3, true),
'description' => $this->faker->sentence(),
'quantity' => $this->faker->numberBetween(1, 10),
'unit_id' => Unit::factory(),
'unit_id' => $unit ? $unit->id : null,
'price' => $this->faker->randomFloat(2, 10, 500),
];
}