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.
topnotch_website/database/factories/InvoiceFactory.php

28 lines
667 B
PHP

<?php
namespace Database\Factories;
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(),
'gst' => true,
'pst' => $this->faker->boolean(25),
'paid' => $this->faker->boolean(),
'customer_id' => $customer->id,
'updated_at' => Carbon::now(),
];
}
}