phpvms/app/Services/ModuleService.php
Arthur Parienté 13a2249b0c
feat(modules): give each module its own Filament panel with a switcher
Modules previously had their Filament resources injected into the main
admin panel and surfaced legacy addAdminLink() items as sidebar nav.
Invert this: each module owns a dedicated Filament panel and a navbar
panel switcher moves between the main panel and module panels.

- Add App\Contracts\Modules\PanelProvider: an abstract base that
  pre-configures id (= module key), path (admin/{key}), middleware,
  auth, branding, the shared admin theme/sidebar (viteTheme +
  sidebarWidth 14.5rem for visual consistency), a Dashboard page, the
  shared plugins, and discovery of the module's own
  Filament/{Resources,Pages,Widgets}. Modules register it via their
  providers list and override only moduleKey().
- Add PanelSwitcherPlugin: a topbar-left dropdown listing the main
  panel plus every module panel the user can access, on every panel.
- Stop injecting module components into the core admin/system panels:
  remove FilamentPanelExtender, its beforeResolving('filament') hook,
  probeFilament(), and the boot-cache filament field (schema bump).
- Remove the legacy link APIs (addAdminLink/addFrontendLink/
  registerLinks) and their blade/view consumers.
- Gate module panels via access:{module-key} in canAccessPanel(),
  with the view:modules fallback.
- Migrate the Sample module to ship its own panel provider and drop
  its old admin controller/route.
2026-06-17 22:41:34 +02:00

35 lines
825 B
PHP

<?php
declare(strict_types=1);
namespace App\Services;
use App\Addons\AddonRegistry;
use App\Contracts\Service;
use Deprecated;
class ModuleService extends Service
{
/**
* Update module with the status passed by user.
*/
#[Deprecated(message: 'Delegate to AddonRegistry::enable()/disable() directly.')]
public function updateModule(string $name, bool $enabled): void
{
if ($enabled) {
app(AddonRegistry::class)->enable($name);
} else {
app(AddonRegistry::class)->disable($name);
}
}
/**
* Delete Module from the Storage & Database.
*/
#[Deprecated(message: 'Delegate to AddonRegistry::delete() directly.')]
public function deleteModule(string $name): void
{
app(AddonRegistry::class)->delete($name);
}
}