install
This commit is contained in:
47
app/Modules/module-helpers.php
Normal file
47
app/Modules/module-helpers.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use App\Modules\ModuleContract;
|
||||
use App\Modules\ModuleRepository;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Return modular repo
|
||||
*/
|
||||
function modular(): ModuleRepository
|
||||
{
|
||||
return app(ModuleRepository::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modules directory path
|
||||
*/
|
||||
function modules_path(string $path = ''): string
|
||||
{
|
||||
return modular()->path().'/'.$path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module
|
||||
*/
|
||||
function module(string $moduleName): ModuleContract
|
||||
{
|
||||
return modular()->module($moduleName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modules
|
||||
*
|
||||
* @return Collection<array-key, App\Modules\BaseModule>
|
||||
*/
|
||||
function modules(bool $withDisabled = false): Collection
|
||||
{
|
||||
return $withDisabled ? modular()->allModules() : modular()->modules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty module
|
||||
*/
|
||||
function emptyModule(): ModuleContract
|
||||
{
|
||||
return modular()->emptyModule();
|
||||
}
|
||||
Reference in New Issue
Block a user