27 lines
583 B
PHP
27 lines
583 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Purchase;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Purchase>
|
|
*/
|
|
class PurchaseFactory extends Factory
|
|
{
|
|
protected $model = Purchase::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'purchase_date' => $this->faker->dateTimeBetween('-1 month', 'now')->format('Y-m-d'),
|
|
'total' => 0, // Calculated later in seeder
|
|
'note' => $this->faker->optional()->sentence(),
|
|
];
|
|
}
|
|
}
|