- Added standard Laravel directory structure and configuration. - Included Svelte and Tailwind configuration for the admin interface. - Added core PHPUnit and testing scripts.
34 lines
972 B
PHP
34 lines
972 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Backups;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Admin\Backups\RestoreBackupRequest;
|
|
use App\Services\BackupService;
|
|
use Exception;
|
|
|
|
/**
|
|
* Controller for restoring a backup.
|
|
*/
|
|
class BackupRestoreController extends Controller
|
|
{
|
|
/**
|
|
* Handle the restore request.
|
|
*
|
|
* @param \App\Http\Requests\Admin\Backups\RestoreBackupRequest $request
|
|
* @param \App\Services\BackupService $service
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
*/
|
|
public function __invoke(RestoreBackupRequest $request, BackupService $service)
|
|
{
|
|
try {
|
|
if ($service->restore($request->input('filename'))) {
|
|
return back()->with('success', 'Site restored successfully.');
|
|
}
|
|
return back()->with('error', 'Failed to restore site.');
|
|
} catch (Exception $e) {
|
|
return back()->with('error', $e->getMessage());
|
|
}
|
|
}
|
|
}
|