Files
InvoiceShelf/app/Http/Controllers/V1/SuperAdmin/Modules/EnableModuleController.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

33 lines
830 B
PHP

<?php
namespace App\Http\Controllers\V1\SuperAdmin\Modules;
use App\Events\ModuleEnabledEvent;
use App\Http\Controllers\Controller;
use App\Models\Module as ModelsModule;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Nwidart\Modules\Facades\Module;
class EnableModuleController extends Controller
{
/**
* Handle the incoming request.
*
* @return Response
*/
public function __invoke(Request $request, string $module)
{
$this->authorize('manage modules');
$module = ModelsModule::where('name', $module)->first();
$module->update(['enabled' => true]);
$installedModule = Module::find($module->name);
$installedModule->enable();
ModuleEnabledEvent::dispatch($module);
return response()->json(['success' => true]);
}
}