First setup: module registry, switchable modules, permissions
This commit is contained in:
commit
936c794597
52 files changed
+1304
No files matched your search
@@ -0,0 +1,49 @@
|
||||
<?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 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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user