faker->numberBetween(20000, 150000); $quantity = $this->faker->numberBetween(1, 5); return [ 'user_id' => User::factory(), 'cogs' => (int) ($unitPrice * 0.4), 'unit_price' => $unitPrice, 'quantity' => $quantity, ]; } public function forOrder(?Order $order = null): Factory { return $this->state(fn () => ['order_id' => $order?->id ?? Order::factory()]); } public function forProduct(?Product $product = null): Factory { $product = $product ?? Product::factory()->create(); return $this->state(fn () => [ 'orderable_type' => $product->getMorphClass(), 'orderable_id' => $product->id, ]); } public function forPerfume(?Perfume $perfume = null): Factory { $perfume = $perfume ?? Perfume::factory()->create(); return $this->state(fn () => [ 'orderable_type' => $perfume->getMorphClass(), 'orderable_id' => $perfume->id, ]); } public function forBottle(?Bottle $bottle = null): Factory { $bottle = $bottle ?? Bottle::factory()->create(); return $this->state(fn () => [ 'orderable_type' => $bottle->getMorphClass(), 'orderable_id' => $bottle->id, ]); } }