Facade Methods

Edit on

There are many methods available for you to use to manage modules from the Module facade.

Get all modules:

Module::all();

Get all cached modules:

Module::getCached();

Get modules ordered by the priority key in each module.json file:

Module::getOrdered();

Get scanned modules:

Module::scan();

Find a specific module:

Module::find('name');

// Or

Module::get('name');

Find a module by name, and if it isn’t found, throw the Rawilk\LaravelModules\Exceptions\ModuleNotFoundException:

Module::findOrFail('name');

Get scanned module paths:

Module::getScanPaths();

Get all modules as a collection instance:

Module::toCollection();

Get modules by status; 1 for active and 0 for inactive:

Module::getByStatus(1);

Check if a given module exists:

Module::has('name');

Get all enabled modules:

Module::allEnabled();

Get all disabled modules:

Module::allDisabled();

Get a count of all modules:

Module::count();

Get module path:

Module::getPath();

Register the modules:

Module::register();

Boot all available modules:

Module::boot();

Get all enabled modules as a collection instance:

Module::collections();

Get the module path from a given module:

Module::getModulePath('name');

Get the assets path for a given module:

Module::assetPath('name');

Get a config value from the laravel-modules package:

Module::config('composer.vendor');

Get the used storage path:

Module::getUsedStoragePath();

Get used module for cli session:

Module::getUsedNow();

// Or

Module::getUsed();

Set the used module for the cli session:

Module::setUsed('name');

Get module’s assets path:

Module::getAssetsPath();

Get an asset url from a given module:

Module::asset('blog::img/logo.png');

Install a given module by name:

Module::install('rawilk/blog');

Update dependencies for a given module:

Module::update('name');

Add a macro to the module repository:

Module::macro('hello', function () {
    echo 'I am a macro';
});

Call a macro from the module repository:

Module::hello();

Get all required modules for a given module:

Module::getRequirements('name');

Get all user defined view partials from all modules for a given module:

Module::getViewPartials('blog');

Nesting is also available via dot notation:

Module::getViewPartials('blog.group_name');