*/ class InvoiceFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition(): array { $date = $this->faker->dateTimeBetween('-1 months', 'now'); return [ 'customer_id' => Customer::inRandomOrder()->first()->id, 'status' => Invoice::$invoiceStatus[rand(0,count(Invoice::$invoiceStatus)-1)], 'desc' => $this->faker->realText(), 'address_id' => null, 'transport_id' => null, 'transport_price' => 0, 'created_at' => $date, 'updated_at' => $date, 'total_price' => 0, ]; } }