31 lines
783 B
PHP
31 lines
783 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Certificate;
|
|
use App\Models\Site;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class CertificateFactory extends Factory
|
|
{
|
|
protected $model = Certificate::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$issued = $this->faker->dateTimeBetween('-60 days', '-1 days');
|
|
return [
|
|
'site_id' => Site::factory(),
|
|
'domain' => $this->faker->domainName(),
|
|
'issuer' => "Let's Encrypt",
|
|
'issued_at' => $issued,
|
|
'expires_at' => (clone $issued)->modify('+90 days'),
|
|
'auto_renew' => true,
|
|
];
|
|
}
|
|
|
|
public function expiringSoon(): self
|
|
{
|
|
return $this->state(['expires_at' => now()->addDays(5)]);
|
|
}
|
|
}
|