*/ class OrderFactory extends Factory { protected $model = Order::class; /** * Define the model's default state. * * @return array */ public function definition(): array { return [ 'user_id' => User::inRandomOrder()->first()?->id ?? User::factory(), 'invoice_number' => 'INV-'.now()->format('YmdHis').'-'.strtoupper($this->faker->bothify('??##')), 'customer_name' => $this->faker->name(), 'hpp' => 0, 'discount' => 0, 'payment' => 0, 'total' => 0, 'payment_method' => $this->faker->randomElement(PaymentMethod::cases()), 'order_status' => $this->faker->randomElement(OrderStatus::cases()), 'order_channel' => $this->faker->randomElement(OrderChannel::cases()), ]; } }