First setup: module registry, switchable modules, permissions

This commit is contained in:
Matthijs Iriks committed 2026-12-04 01:18:14 +01:00
commit 936c794597
52 files changed
+1304

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
<?php
namespace IriksIT\Manager\Contracts;
/**
* One switchable part of the manager. A module that is off contributes nothing:
* no routes, no migrations, no menu items, no permissions.
*/
interface Module
{
/** Short unique key, also the key in config('manager.modules'). */
public function key(): string;
/** Name in the menu. */
public function label(): string;
/** Core modules (users, media) are on unless a site explicitly turns them off. */
public function enabledByDefault(): bool;
/** @return list<string> keys of modules this one cannot work without */
public function requires(): array;
/**
* Permissions this module adds, as value => label. Values are prefixed by the module key.
*
* @return array<string, string>
*/
public function permissions(): array;
/** @return list<array{label: string, route: string, permission: string}> */
public function navigation(): array;
/** Absolute path of the routes file, or null. */
public function routes(): ?string;
/** Absolute path of the migrations folder, or null. */
public function migrations(): ?string;
}