public function publishAssets(Module $module) { try { Artisan::call('module:publish', ['module' => $module->getName()]); } catch (InvalidArgumentException $e) { } }
/** * Get the permissions from all the enabled modules * @return array */ public function all() { $permissions = []; foreach ($this->module->enabled() as $enabledModule) { $configuration = config(strtolower('asgard.' . $enabledModule->getName()) . '.permissions'); if ($configuration) { $permissions[$enabledModule->getName()] = $configuration; } } return $permissions; }
public function getModuleSettings(Module $currentModule) { $this->assetPipeline->requireJs('selectize.js'); $this->assetPipeline->requireCss('selectize.css'); $this->assetPipeline->requireCss('selectize-default.css'); $this->session->set('module', $currentModule->getLowerName()); $modulesWithSettings = $this->setting->moduleSettings($this->module->enabled()); $translatableSettings = $this->setting->translatableModuleSettings($currentModule->getLowerName()); $plainSettings = $this->setting->plainModuleSettings($currentModule->getLowerName()); $dbSettings = $this->setting->savedModuleSettings($currentModule->getLowerName()); return view('setting::admin.module-settings', compact('currentModule', 'translatableSettings', 'plainSettings', 'dbSettings', 'modulesWithSettings')); }
/** * @param Module $module */ protected function bootModuleBlocks(Module $module) { foreach ($module->get('blocks') as $block) { $moduleName = studly_case($module->getName()); $block = studly_case($block); $class = "Modules\\{$moduleName}\\Components\\{$block}Block"; if (class_exists($class)) { /* @var BaseBlock $moduleBlock */ $moduleBlock = app()->make($class)->setModuleName($moduleName)->setComponentName($block); $moduleBlock->boot($moduleName, $block); } } }
protected function handleModuleBowerInstall(Module $module) { $path = $module->getPath(); if (!$this->bowerFileExists($path)) { return $this->info("Skipping bower install for module '{$module->getName()}': bower.json file not found. "); } $this->info("Installing bower components for module '{$module->getName()}'"); $result = null; passthru($this->getExecCommand($path), $result); if ($result !== self::EXIT_SUCCESS) { $this->error('Bower install ended with error!'); } }
/** * Get module path. If $name not null, we will use that. * * @param string $name * @return string */ protected function getModulePath($name = null) { if ($name) { return $this->module->getModulePath($name); } return $this->module->getPath(); }
/** * Initialize a list of given command options with their default values. * * @return $this */ protected function initOptions() { $module = $this->module->getStudlyName(); $ns = "Modules\\{$module}"; $this->options = ['connection' => $this->getOption('connection', null), 'ignore' => $this->getOption('ignore', []), 'path' => $this->getOption('path', ''), 'templatePath' => $this->getOption('templatePath', ''), 'namespace' => $this->getOption('namespace', $ns), 'defaultIndexNames' => $this->getOption('defaultIndexNames', false), 'defaultFKNames' => $this->getOption('defaultFKNames', false), 'overwrite' => $this->getOption('overwrite', false)]; return $this; }
/** * Register the service provider. * * @return void */ public function register() { $this->registerProviders(); $this->registerFacades(); $module = Module::getInstance(); $module->register(); $this->registerModuleMakeGenerator(); $this->registerModuleControllerGenerator(); $this->registerModuleMigrateGenerator(); $this->registerModuleMigrateMakeGenerator(); $this->registerModuleMigrateRefreshGenerator(); $this->registerModuleSeederGenerator(); $this->registerModuleSetupGenerator(); $this->commands('module.make', 'module.controller', 'module.migrate', 'module.migrate-make', 'module.migrate-refresh', 'module.seeder', 'module.setup'); }
/** * Register the config namespace. * * @param Module $module */ private function registerVendorConfig(Module $module) { $files = $this->app['files']->files($module->getPath() . '/Config/Vendor'); foreach ($files as $file) { $filename = preg_replace('/\\.[^.\\s]{3,4}$/', '', basename($file)); $this->mergeConfigFrom($file, $filename); } }
/** * Get the changelog for the given module. * * @param Module $module * * @return array */ public function changelogFor(Module $module) { $path = $module->getPath() . '/CHANGELOG.md'; if (!$this->finder->isFile($path)) { return []; } $parser = new \Changelog\Parser(file_get_contents($path)); return $parser->getReleases(); }
/** * Enable the given module. * * @param Module $module * * @return mixed */ public function enable(Module $module) { $module->enable(); }
/** * Check if the given module is a core module that should be be disabled * @param Module $module * @return bool */ private function isCoreModule(Module $module) { $coreModules = array_flip(config('asgard.core.config.CoreModules')); return isset($coreModules[$module->getLowerName()]); }
/** * @param Module $currentModule * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function edit(Module $currentModule) { $currentModuleSettings = $this->setting->moduleConfig($currentModule->getLowerName()); $modules = $this->setting->moduleConfig($this->module->enabled()); return view('setting::backend.settings.module-settings', compact('currentModule', 'currentModuleSettings', 'modules')); }
/** * Setup the module assets folder. */ protected function setupAssetsFolder() { $this->createFolder($this->module->getAssetsPath(), 'The module assets folder has been created successful.', 'The module assets already exist.'); }
/** * Get seeder path. * * @return string */ protected function getPath() { return $this->module->getModulePath($this->moduleName) . "database/seeds/"; }
/** * Get migration path. * * @return string */ public function getPath() { return $this->module->getExtraPath(config('modules.paths.generator.migration')); }
/** * Register the config namespace * @param Module $module */ private function registerConfigNamespace(Module $module) { $files = $this->app['files']->files($module->getPath() . '/Config'); $package = $module->getName(); foreach ($files as $file) { $filename = $this->getConfigFilename($file, $package); $this->mergeConfigFrom($file, $filename); $this->publishes([$file => config_path($filename . '.php')], 'config'); } }
/** * Get migration path for the specified module. * * @param $module * @return string */ protected function getMigrationPath($module) { return $this->module->getModulePath($module) . 'database/migrations/'; }
/** * Get model paths. * * @return string */ protected function getModelPath() { return $this->module->getModulePath($this->moduleName) . "/models/"; }
/** * Get the absolute path to the Centralised Translations for a Module (via the Translations module) * @param Module $module * @return string */ private function getCentralisedTranslationPath(Module $module) { return $this->app['modules']->find('Translation')->getPath() . "/Resources/lang/{$module->getName()}"; }
/** * Get destination assets path for the specified module. * * @param string $name * @return string */ public function getDestinationPath($name) { return realpath($this->module->getAssetsPath()) . "/{$name}/"; }
/** * Get migration path for specific module. * * @param \Pingpong\Modules\Module $module * @return string */ protected function getPath($module) { $path = $module->getExtraPath(config('modules.paths.generator.migration')); return str_replace(base_path(), '', $path); }
/** * Get the changelog for the given module * @param Module $module * @return array */ public function changelogFor(Module $module) { $path = $module->getPath() . '/changelog.yml'; if (!$this->finder->isFile($path)) { return []; } $yamlParser = new Parser(); $changelog = $yamlParser->parse(file_get_contents($path)); $changelog['versions'] = $this->limitLastVersionsAmount(array_get($changelog, 'versions', [])); return $changelog; }