Certificate manager built on Laravel 13, Livewire 4, and Flux. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Certificate;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Certificate>
|
|
*/
|
|
class CertificateFactory extends Factory
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'user_id' => User::factory(),
|
|
'category_id' => null,
|
|
'title' => fake()->sentence(3),
|
|
'issuer' => fake()->company(),
|
|
'certificate_number' => fake()->bothify('CERT-####-????'),
|
|
'issued_at' => fake()->dateTimeBetween('-2 years', '-1 month'),
|
|
'file_path' => null,
|
|
'expires_at' => fake()->dateTimeBetween('+2 months', '+2 years'),
|
|
'notes' => null,
|
|
];
|
|
}
|
|
|
|
public function expired(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'expires_at' => fake()->dateTimeBetween('-2 years', '-1 day'),
|
|
]);
|
|
}
|
|
|
|
public function expiringSoon(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'expires_at' => today()->addWeeks(2),
|
|
]);
|
|
}
|
|
}
|