public static function publish($module_slug) { require path('sys') . 'cli/dependencies' . EXT; try { $module_assets_path = path('bundle') . $module_slug . '/public/'; if (\File::exists($module_assets_path)) { \Bundle::register($module_slug); $publish_cmd = \Laravel\CLI\Command::run(array('bundle:publish', $module_slug)); \Bundle::disable($module_slug); return true; } return true; } catch (\Exception $e) { Log::error($e->getMessage()); static::$errors->add('installer', 'Failed to publish assets for module [' . $module_slug . '].'); return false; } }
/** * Add an error message to the validator's collection of messages. * * @param string $attribute * @param string $rule * @param array $parameters * @return void */ protected function error($attribute, $rule, $parameters) { $message = $this->replace($this->message($attribute, $rule), $attribute, $rule, $parameters); $this->errors->add($attribute, $message); }
/** * Get the first message from the container for a given key. * * <code> * // Echo the first message out of all messages. * echo $messages->first(); * * // Echo the first message for the e-mail attribute * echo $messages->first('success'); * * // Format the first message for the e-mail attribute * echo $messages->first('success', '<p>:message</p>'); * </code> * * @param string $key * @param string $format * @return Entry */ public function first($key = null, $format = null) { $message = parent::first($key, $format); return $message instanceof Entry ? $message : null; }
/** * Checks if the module is valid * and can be loaded * * @return Module */ public function is_valid() { $info_file_path = ''; if (!file_exists($this->path)) { $this->errors->add($this->slug, 'Module [' . $this->slug . '] was not found'); return false; } $info_files = glob($this->path . 'info.*'); if (empty($info_files)) { $this->errors->add($this->slug, 'The information file for [' . $this->slug . '] module is missing'); return false; } $info_file_path = $info_files['0']; $this->file_info_type = file_extension($info_file_path); // create method to decode // other types of info files $json_module_info = json_decode(File::get($info_file_path), true); if (!isset($json_module_info) or empty($json_module_info)) { $this->errors->add('module', 'The information file for module [' . $this->slug . '] is malformed'); return false; } foreach ($json_module_info as $property => $value) { if (property_exists($this, $property)) { $this->{$property} = $value; } } $this->exist = true; return $this; }