@extends('admin.layout')
@section('title', 'Database')
@section('content')
@php
$fmt = fn($n) => number_format((float) $n, 0, ',', '.');
$mb = fn($n) => number_format($n / 1024 / 1024, 2) . ' MB';
$uptime = fn($s) => sprintf('%dd %dh %dm', $s/86400, ($s%86400)/3600, ($s%3600)/60);
$sc = fn($label, $value, $color='gray', $sub='') =>
"
{$label}
{$value}
" .
($sub ? "
{$sub}
" : '') .
"
";
@endphp
@include('admin.partials.server-database')
{{-- ── Flash-berichten ─────────────────────────────────────────────────── --}}
@if (session('success'))
✓ {{ session('success') }}
@endif
@if (session('error'))
✗ {{ session('error') }}
@endif
{{-- ── Integriteitscontrole ────────────────────────────────────────────── --}}
@php
$groups = collect($integrity)->groupBy('cat');
$totalBad = collect($integrity)->sum(fn($c) => max(0, $c['count']));
$isAdmin = auth()->user()->isAdmin();
@endphp
{{-- Header --}}
Integriteitscontrole
@if ($totalBad > 0)
{{ $totalBad }} probleem{{ $totalBad !== 1 ? 'en' : '' }}
@else
✓ Alles in orde
@endif
@if ($isAdmin && $totalBad > 0)
@endif
Ververs
{{-- Checks gegroepeerd per categorie --}}
@foreach ($groups as $catName => $catChecks)
{{ $catName }}
@foreach ($catChecks as $check)
@php
$bad = $check['count'] > 0;
$failed = $check['count'] === -1;
$hasRows = ! empty($check['rows']);
@endphp
@if ($hasRows)
{{-- Uitklapbaar wanneer er problemen zijn --}}
❌
{{ $check['label'] }}
— {{ $check['hint'] }}
{{-- Voorbeeldrijen --}}
@foreach (array_keys((array) $check['rows'][0]) as $col)
| {{ $col }} |
@endforeach
@foreach ($check['rows'] as $row)
@foreach ((array) $row as $val)
| {{ $val ?? '·' }} |
@endforeach
@endforeach
@if ($check['count'] > 5)
+ {{ $check['count'] - 5 }} meer niet getoond
@endif
{{-- Herstel-knop (alleen admins) --}}
@if ($isAdmin)
@endif
@else
{{-- OK of query mislukt --}}
@if ($failed) ⚠️ @else ✅ @endif
{{ $check['label'] }}
— {{ $check['hint'] }}
{{ $failed ? '?' : '0' }}
@endif
@endforeach
@endforeach
{{-- ── Tabellenoverzicht ───────────────────────────────────────────────── --}}
{{ $dbTotals['tables'] }} tabellen ·
Data: {{ $dbTotals['data_mb'] }} MB ·
Index: {{ $dbTotals['index_mb'] }} MB ·
~{{ $fmt($dbTotals['total_rows']) }} rijen
| Tabel |
Rijen |
Data |
Index |
Totaal |
Grootte |
@php $maxSize = max(collect($tables)->max('total_size'), 1); @endphp
@foreach ($tables as $t)
| {{ $t->table_name }} |
{{ $fmt($t->table_rows) }} |
{{ $mb($t->data_length) }} |
{{ $mb($t->index_length) }} |
{{ $mb($t->total_size) }} |
|
@endforeach
@endsection