예제 #1
0
 public function publishAssets(Module $module)
 {
     try {
         Artisan::call('module:publish', ['module' => $module->getName()]);
     } catch (InvalidArgumentException $e) {
     }
 }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
 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'));
 }
예제 #4
0
 /**
  * @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);
         }
     }
 }
예제 #5
0
 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!');
     }
 }
예제 #6
0
 /**
  * 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;
 }
예제 #8
0
 /**
  * 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');
 }
예제 #9
0
 /**
  * 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);
     }
 }
예제 #10
0
 /**
  * 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();
 }
예제 #11
0
 /**
  * Enable the given module.
  *
  * @param Module $module
  *
  * @return mixed
  */
 public function enable(Module $module)
 {
     $module->enable();
 }
예제 #12
0
 /**
  * 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()]);
 }
예제 #13
0
 /**
  * @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'));
 }
예제 #14
0
 /**
  * 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.');
 }
예제 #15
0
 /**
  * Get seeder path.
  *
  * @return string
  */
 protected function getPath()
 {
     return $this->module->getModulePath($this->moduleName) . "database/seeds/";
 }
예제 #16
0
 /**
  * Get migration path.
  *
  * @return string
  */
 public function getPath()
 {
     return $this->module->getExtraPath(config('modules.paths.generator.migration'));
 }
예제 #17
0
 /**
  * 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/';
 }
예제 #19
0
 /**
  * Get model paths.
  *
  * @return string
  */
 protected function getModelPath()
 {
     return $this->module->getModulePath($this->moduleName) . "/models/";
 }
예제 #20
0
 /**
  * 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()}";
 }
예제 #21
0
 /**
  * Get destination assets path for the specified module.
  *
  * @param  string $name
  * @return string
  */
 public function getDestinationPath($name)
 {
     return realpath($this->module->getAssetsPath()) . "/{$name}/";
 }
예제 #22
0
 /**
  * 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);
 }
예제 #23
0
 /**
  * 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;
 }