62 lines
1.2 KiB
PHP
62 lines
1.2 KiB
PHP
<?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 [];
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|