You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
use App\Enums\InvoiceStatus;
|
|
|
|
use App\Models\Customer;
|
|
|
|
use App\Models\Invoice;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
use Illuminate\Support\Carbon;
|
|
|
|
|
|
|
|
class InvoiceFactory extends Factory
|
|
|
|
{
|
|
|
|
protected $model = Invoice::class;
|
|
|
|
|
|
|
|
public function definition(): array
|
|
|
|
{
|
|
|
|
$customer = Customer::all()->shuffle()->first();
|
|
|
|
|
|
|
|
return [
|
|
|
|
'created_at' => Carbon::now()->subDays(rand(1, 30)),
|
|
|
|
'gst' => true,
|
|
|
|
'pst' => $this->faker->boolean(25),
|
|
|
|
'status' => $this->faker->randomElement(InvoiceStatus::cases())->value,
|
|
|
|
'customer_id' => $customer->id,
|
|
|
|
'updated_at' => Carbon::now(),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|