installModule() public method

Install the module
public installModule ( $file ) : array
$file
return array $input
Example #1
0
 /**
  * Install all modules bundled with the theme
  */
 protected function installModules()
 {
     if (!isset($this->config['modules'])) {
         return false;
     }
     $modules = $this->config['modules'];
     $module_installer = new ModuleInstaller();
     foreach ($modules as $module) {
         $module_dir = "{$this->full_path}modules/{$module}/";
         if (file_exists($module_dir) && file_exists($module_dir . 'module.json')) {
             $module_data = $module_installer->installModule($module_dir);
             if ($module = Module::where('alias', '=', $module_data['alias'])->first()) {
                 $module->update($module_data);
             } else {
                 $module = Module::create($module_data);
             }
         }
     }
 }