This commit is contained in:
deploy-bot committed 2026-12-04 16:24:51 +00:00
commit 8f8513f802
278 files changed
+18400

No files matched your search

+98
View File
@@ -0,0 +1,98 @@
<?php
namespace IriksIT\Manager\Modules;
use IriksIT\Manager\Contracts\Module;
/**
* Convention over configuration: a module `Foo` lives in src/Modules/Foo, with
* routes.php and a migrations/ folder next to its class when it needs them.
*/
abstract class BaseModule implements Module
{
public function enabledByDefault(): bool
{
return false;
}
public function requires(): array
{
return [];
}
public function permissions(): array
{
return [];
}
public function navigation(): array
{
return [];
}
public function routes(): ?string
{
return $this->path('routes.php');
}
public function publicRoutes(): ?string
{
return $this->path('public-routes.php');
}
public function commands(): array
{
return [];
}
/**
* Tables (without the prefix) this module needs; `manager:doctor` checks that they exist.
*
* @return list<string>
*/
public function tables(): array
{
return [];
}
/**
* Steps this module adds to the tour. Each: `title` and `text` (English, translated through `__()`), an optional `image` (one of
* the pictures of the tour, `MascotController::NAMES`), `menu` (the short route name of a menu item to point at, like `reviews.index`)
* and `permission` (the step is left out for an account without it). The contract `Module` does not know this: a module without it adds none.
*
* @return list<array{title: string, text: string, image?: string, menu?: string, permission?: string}>
*/
public function tutorial(): array
{
return [];
}
public function actions(): array
{
return [];
}
public function views(): array
{
return [];
}
public function middleware(): array
{
return [];
}
public function boot(): void {}
public function migrations(): ?string
{
return $this->path('migrations');
}
private function path(string $name): ?string
{
$path = dirname((new \ReflectionClass($this))->getFileName()).'/'.$name;
return file_exists($path) ? $path : null;
}
}