- Added standard Laravel directory structure and configuration. - Included Svelte and Tailwind configuration for the admin interface. - Added core PHPUnit and testing scripts.
32 lines
800 B
PHP
32 lines
800 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Backups;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Admin\Backups\DownloadBackupRequest;
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
/**
|
|
* Controller for downloading a backup file.
|
|
*/
|
|
class BackupDownloadController extends Controller
|
|
{
|
|
/**
|
|
* Download a specific backup file.
|
|
*
|
|
* @param \App\Http\Requests\Admin\Backups\DownloadBackupRequest $request
|
|
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
|
|
*/
|
|
public function __invoke(DownloadBackupRequest $request)
|
|
{
|
|
$filename = $request->query('filename');
|
|
$path = storage_path('app/backups/' . $filename);
|
|
|
|
if (!File::exists($path)) {
|
|
abort(404);
|
|
}
|
|
|
|
return response()->download($path);
|
|
}
|
|
}
|