@extends('layouts.user_type.auth') @section('backupLog')
@include('components.alert') @php $ls = $summary['last_success']; $last = $summary['last']; $blTone = fn ($s) => $s === 'success' ? 'z-badge--success' : ($s === 'running' ? 'z-badge--info' : 'z-badge--danger'); @endphp {{-- stale / failure banner --}} @if($summary['stale'])

@if($ls)No successful database backup for {{ $ls->ran_at->diffForHumans(null, true) }} (expected every {{ $summary['stale_hours'] }} h). Check the crontab on the backup server.@else No successful database backup has been recorded yet. Add the backup:log call to your crontab backup script (see “How to connect” below).@endif

@elseif($last && $last->status === 'failed')

The latest backup run failed {{ $last->ran_at->diffForHumans() }}: {{ \Illuminate\Support\Str::limit($last->message, 140) }}

@endif {{-- summary --}}
Last successful backup
{{ $ls ? $ls->ran_at->diffForHumans() : 'Never' }}
{{ $summary['stale'] ? 'Stale' : 'Healthy' }} @if($ls){{ $ls->ran_at->format('d M Y, H:i') }}@endif
Latest backup size
{{ $summary['latest_size'] }}
@if($last){{ ucfirst($last->status) }}@endif @if($ls && $ls->storage_path){{ $ls->storage_path }}@endif
Success rate · 30 days
{{ $summary['success_rate'] !== null ? $summary['success_rate'].'%' : '—' }}
Runs · 30 days
{{ $summary['runs_30'] }}
{{ $summary['failed_30'] }} failed
{{-- history --}}
Backup history
Every database backup run reported by the crontab script.
{{ $logs->total() }} records
@forelse($logs as $i => $log) @empty @endforelse
Backup Status File Size Duration Server Finished
{{ $log->backup_name }} {{ $log->database_name ?: 'Database' }} · {{ ucfirst($log->source) }}
{{ ucfirst($log->status) }}
{{ $log->file_name ?: '—' }}
@if($log->status === 'failed' && $log->message)
{{ $log->message }}
@elseif($log->storage_path)
{{ $log->storage_path }}
@endif
{{ $log->size_for_humans }} {{ $log->duration_seconds !== null ? gmdate($log->duration_seconds >= 3600 ? 'H:i:s' : 'i:s', (int) $log->duration_seconds) : '—' }} {{ $log->host ?: '—' }} {{ $log->ran_at->format('d M Y') }}{{ $log->ran_at->format('H:i:s') }}
No backups recorded yet
Runs appear here once the crontab script reports them.
@include('components.pagination', ['paginator' => $logs])
{{-- how to connect the crontab --}}
How to connect your crontab backup
Add one line after the dump/upload in the backup script on Google Cloud.

Same server as this app — run the artisan command:

php {{ base_path('artisan') }} backup:log success --name=mysql-daily --database=all \
    --file="$FILE" --size="$(stat -c%s "$LOCAL_FILE")" --path="gs://YOUR_BUCKET/$FILE" --duration="$SECONDS"

# on failure (e.g. in the script's error trap)
php {{ base_path('artisan') }} backup:log failed --name=mysql-daily --message="mysqldump failed"

Different server — call the API (set BACKUP_LOG_TOKEN in .env first):

curl -fsS -X POST {{ url('/api/backup-log') }} \
  -H "X-Backup-Token: $BACKUP_LOG_TOKEN" -H "Accept: application/json" \
  -d status=success -d backup_name=mysql-daily -d file_name="$FILE" \
  -d file_size="$(stat -c%s "$LOCAL_FILE")" -d storage_path="gs://YOUR_BUCKET/$FILE"
@endsection