Files
InvoiceShelf/app/Http/Controllers/V1/SuperAdmin/Update/UnzipUpdateController.php
Darko Gjorgjijoski bbf46577dc Move global admin controllers from Admin to SuperAdmin namespace
Backup, Update, Modules, and global Settings controllers (mail config,
PDF config, disk management, global settings) are application-wide features
not scoped to a company. Move them from Admin/ to SuperAdmin/ to match the
v3.0 UI structure where these live under Administration.

Company-scoped settings controllers remain in Admin/Settings/.
2026-04-03 16:52:18 +02:00

45 lines
1.1 KiB
PHP

<?php
namespace App\Http\Controllers\V1\SuperAdmin\Update;
use App\Http\Controllers\Controller;
use App\Services\Update\Updater;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class UnzipUpdateController extends Controller
{
/**
* Handle the incoming request.
*
* @return Response
*/
public function __invoke(Request $request)
{
if ((! $request->user()) || (! $request->user()->isOwner())) {
return response()->json([
'success' => false,
'message' => 'You are not allowed to update this app.',
], 401);
}
$request->validate([
'path' => 'required',
]);
try {
$path = Updater::unzip($request->path);
return response()->json([
'success' => true,
'path' => $path,
]);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'error' => $e->getMessage(),
], 500);
}
}
}