lots of progress

This commit is contained in:
Doar Mihai
2026-01-17 13:46:20 +02:00
parent ab5d3cae98
commit 030a105992
77 changed files with 8507 additions and 20 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace Database\Factories;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\BrokenLink>
*/
class BrokenLinkFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$brokenStatusCodes = [404, 500, 503, 403, 410];
return [
'site_id' => Site::factory(),
'url' => fake()->url(),
'status_code' => fake()->randomElement($brokenStatusCodes),
'last_checked_at' => fake()->dateTimeBetween('-14 days', 'now'),
];
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Site>
*/
class SiteFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'user_id' => User::factory(),
'url' => fake()->url(),
'name' => fake()->company() . ' Website',
'monitoring_enabled' => fake()->boolean(80), // 80% chance of being enabled
];
}
}
@@ -0,0 +1,35 @@
<?php
namespace Database\Factories;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\SslCertificate>
*/
class SslCertificateFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$issuers = [
"Let's Encrypt",
'DigiCert Inc',
'Google Trust Services',
'Amazon',
'Cloudflare Inc',
];
return [
'site_id' => Site::factory(),
'issuer' => fake()->randomElement($issuers),
'expires_at' => fake()->dateTimeBetween('now', '+365 days'),
'checked_at' => fake()->dateTimeBetween('-7 days', 'now'),
];
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace Database\Factories;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\UptimeCheck>
*/
class UptimeCheckFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$statusCodes = [200, 200, 200, 200, 301, 302, 404, 500, 503]; // Weighted towards 200
return [
'site_id' => Site::factory(),
'status_code' => fake()->randomElement($statusCodes),
'response_time_ms' => fake()->numberBetween(50, 5000),
'checked_at' => fake()->dateTimeBetween('-30 days', 'now'),
];
}
}