<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class BackupDownloadController extends Controller
{
    /**
     * FORCE DOWNLOAD .sql files
     */
   public function download($filename)
{
    $path = public_path('storage/backup/' . $filename);

    if (!file_exists($path)) {
        abort(404, 'Backup file not found at: ' . $path);
    }

    return response()->download($path, $filename, [
        'Content-Type' => 'application/octet-stream',
        'Content-Disposition' => 'attachment; filename="' . $filename . '"',
    ]);
}
}