src/Providers/ModulesServiceProvider.php
public function register()
    {
        AliasLoader::getInstance(['Modules' => ModulesFacade::class,]);

        $this->registerConfig();
        $this->registerServices();
        $this->registerCommands();
        $this->registerModules();

        $this->app->afterResolving('view', function (ViewFactory $view) {
            $view->composer('*', function (View $view) {
                $name = explode('::', $view->getName(), 2);
                if (count($name) > 1) {
                    $view->with('module_name', $name[0]);
                }
            });
        });

        $this->app->afterResolving('blade.compiler', function (BladeCompiler $compiler) {
            $compiler->directive('mlang', function ($expression) {
                return "<?php echo trans(\$module_name.'::'.{$expression}); ?>";
            });
            $compiler->directive('masset', function ($expression) {
                return "<?php echo module_asset(\$module_name, {$expression}); ?>";
            });
        });
    }
public function register()
    {
        AliasLoader::getInstance(['Modules' => ModulesFacade::class,]);

        $this->registerConfig();
        $this->registerServices();
        $this->registerCommands();
        $this->registerModules();

        $this->app->afterResolving('view', function (ViewFactory $view) {
            $view->composer('*', function (View $view) {
                $name = explode('::', $view->getName(), 2);
                if (count($name) > 1) {
                    $view->with('module_name', $name[0]);
                }
            });
        });

        $this->app->afterResolving('blade.compiler', function (BladeCompiler $compiler) {
            $compiler->directive('mlang', function ($expression) {
                return "<?php echo trans(\$module_name.'::'.{$expression}); ?>";
            });
            $compiler->directive('masset', function ($expression) {
                return "<?php echo module_asset(\$module_name, {$expression}); ?>";
            });
        });
    }
Register the service provider.