@extends('admin.layouts.master-soyuz')
@section('title', __('Backup Manager'))
@section('body')
@component('admin.component.breadcumb',['secondaryactive' => 'active'])
@slot('heading'){{ __('Backup Manager') }}@endslot
@slot('menu1'){{ __('Backup Manager') }}@endslot
@endcomponent
@php
$dir17 = storage_path() . '/app/' . config('app.name');
$backups = collect(array_reverse(glob("$dir17/*") ?: []))
->filter(function ($f) { return is_file($f) && pathinfo($f, PATHINFO_EXTENSION) === 'zip'; })
->values();
$latest = $backups->first();
$dumpPath = env('SQL_DUMP_PATH');
@endphp
@if ($errors->any())
@foreach($errors->all() as $error)
{{ $error }}
@endforeach
@endif
@if(session('success'))
{{ session('success') }}
@endif
{{-- Hero status --}}
{{ __('Database Backup Manager') }}
{{ $backups->count() ? trans_choice('{1} :count backup file stored|[2,*] :count backup files stored', $backups->count(), ['count' => $backups->count()]) : __('No backups yet — generate your first one.') }}
{{-- LEFT: dump path config --}}
{{-- Schedule UI placeholder if any --}}
@if(!empty($html))
@endif
{{-- RIGHT: backup list --}}
@if($backups->isEmpty())
{{ __('No backup files yet.') }}
@else
@foreach($backups as $i => $file)
@php
$name = basename($file);
$size = is_file($file) ? round(filesize($file) / 1024 / 1024, 2) : 0;
$time = is_file($file) ? \Carbon\Carbon::createFromTimestamp(filemtime($file))->diffForHumans() : '';
@endphp
{{ $name }}
@if($i === 0)
{{ __('Latest') }}
@endif
{{ $size }} MB · {{ $time }}
@endforeach
@endif
@endsection