Files
website/website/database/factories/LoginHistoryFactory.php
Claude Dev b4ef90465c feat: complete pre-launch audit — frontend polish, churn prevention, login history, financial reports, configurable checkout
Includes all work from phases 6-9+ and frontend polish rounds 1 & 2:

- Login history with device trust, new device notifications, session management
- Churn prevention: cancellation surveys, winback campaigns with email sequences
- Financial reports: revenue, P&L, tax, aging, refund, subscription reports with PDF/CSV/JSON export
- Configurable checkout: plan config groups/options, build-your-own VPS
- Frontend polish: fix broken legal links, add SEO meta tags, favicon, font display=swap,
  Head titles on all 14 marketing pages, mobile responsive fixes, AuthLayout legal footer,
  remove false 24/7 claims, hide empty stats, correct uptime SLA to 99.9%,
  GameServers notify buttons linked to /contact, 301 redirects for /terms and /privacy
- WHMCS migration scripts
- Update legal page effective dates to March 16, 2026

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 11:39:25 -04:00

50 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\LoginHistory;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<LoginHistory> */
class LoginHistoryFactory extends Factory
{
/** @return array<string, mixed> */
public function definition(): array
{
$userAgent = fake()->userAgent();
$ip = fake()->ipv4();
return [
'user_id' => User::factory(),
'ip_address' => $ip,
'user_agent' => $userAgent,
'device_type' => fake()->randomElement(['Desktop', 'Phone', 'Tablet']),
'browser' => fake()->randomElement(['Chrome', 'Firefox', 'Safari', 'Edge']),
'os' => fake()->randomElement(['Windows 10', 'macOS', 'Ubuntu', 'iOS', 'Android']),
'location_country' => fake()->country(),
'location_city' => fake()->city(),
'success' => true,
'two_factor_used' => false,
'is_new_device' => false,
'device_hash' => LoginHistory::generateDeviceHash($userAgent, $ip),
];
}
public function failed(): static
{
return $this->state(fn (array $attributes): array => [
'success' => false,
]);
}
public function newDevice(): static
{
return $this->state(fn (array $attributes): array => [
'is_new_device' => true,
]);
}
}