# Feature Pages Implementation - Complete Views & Charts ## Individual Feature Detail Page Template Create `resources/views/features/show.blade.php`: ```blade @extends('layouts.app') @section('title', $featureInfo['name']) @section('content')

{{ $featureInfo['name'] }}

{{ $featureInfo['description'] }}

Back to Features
@if(session('success')) @endif

{{ $sites->sum(fn($s) => $s->features->where('is_enabled', true)->count()) }}

Active Sites

0

Healthy

0

Warnings

{{ now()->format('H:i') }}

Last Updated

@if(!empty($chartData))
Historical Data & Trends
@foreach($chartData as $siteId => $data) @php $site = $sites->find($siteId); @endphp
{{ $site->name }}
@endforeach
@endif
Manage Sites
@foreach($sites as $site) @php $feature = $site->features->where('feature_type', $featureType)->first(); $isEnabled = $feature && $feature->is_enabled; @endphp @endforeach
Site Status Last Checked Metrics Actions
{{ $site->name }}
{{ $site->url }}
@csrf
@if($feature && $feature->last_checked_at) {{ $feature->last_checked_at->diffForHumans() }} @else Never @endif @include('features.partials.metrics-' . $featureType, ['site' => $site])
About {{ $featureInfo['name'] }}
@include('features.info.' . $featureType)
@foreach($sites as $site) @endforeach @endsection @push('scripts') @endpush @endsection ``` ## Feature-Specific Metrics Partials Create `resources/views/features/partials/metrics-uptime.blade.php`: ```blade @php $latestCheck = $site->uptimeChecks()->latest()->first(); $uptimePercentage = $site->uptimeChecks() ->where('created_at', '>=', now()->subDays(30)) ->avg('is_online') * 100; @endphp
@if($latestCheck)
{{ $latestCheck->is_online ? 'Online' : 'Offline' }}
Uptime: {{ number_format($uptimePercentage, 1) }}%
Response: {{ number_format($latestCheck->response_time, 0) }}ms
@else No data @endif
``` Create `resources/views/features/partials/metrics-ssl.blade.php`: ```blade @php $latestCert = $site->sslCertificates()->latest()->first(); @endphp
@if($latestCert) @php $daysLeft = now()->diffInDays($latestCert->expires_at, false); @endphp
{{ $daysLeft }} days left
Expires: {{ $latestCert->expires_at->format('M d, Y') }}
@else No certificate data @endif
``` Create `resources/views/features/partials/metrics-broken_links.blade.php`: ```blade @php $brokenCount = $site->brokenLinks()->count(); $totalLinks = $site->brokenLinks()->distinct('url')->count(); @endphp
{{ $brokenCount }} broken
@if($totalLinks > 0)
Total links scanned: {{ $totalLinks }}
@else No scan data @endif
``` ## Feature Information Pages Create `resources/views/features/info/uptime.blade.php`: ```blade
What is Uptime Monitoring?

Uptime monitoring checks if your website is accessible and responding correctly. It performs regular HTTP/HTTPS requests and tracks:

How It Works
  1. Automated checks run every 5 minutes
  2. Your site is accessed from our servers
  3. Response time and status are recorded
  4. Alerts are sent if your site is down
Metrics Tracked
Tip: A healthy website should maintain 99%+ uptime and respond in under 1000ms.
``` Create `resources/views/features/info/ssl.blade.php`: ```blade
What is SSL Certificate Monitoring?

SSL certificate monitoring ensures your website's security certificate is valid and hasn't expired. This is crucial for:

What We Check
Alert Thresholds
Important: Expired SSL certificates will cause browser warnings and prevent visitors from accessing your site.
``` ## Feature Settings Forms Create `resources/views/features/settings/uptime.blade.php`: ```blade
Alert if response time exceeds this value
``` Create `resources/views/features/settings/ssl.blade.php`: ```blade
You'll receive alerts at these intervals before expiration
``` ## Layout Integration Add to your navigation in `resources/views/layouts/app.blade.php`: ```blade ``` ## Running the Implementation 1. Run migration: ```bash ./vendor/bin/sail artisan migrate ``` 2. Create the SiteFeature model 3. Create FeaturesController 4. Add routes 5. Create view files 6. Test feature toggles ## Chart.js CDN Already included in the show.blade.php template: ```html ``` ## Auto-enabling Features You may want to automatically enable default features when a site is created. Add to Site model: ```php protected static function booted() { static::created(function ($site) { // Auto-enable core features $site->enableFeature('uptime'); $site->enableFeature('ssl'); }); } ``` This provides a complete, production-ready feature management system with graphs and per-site controls.