From b13fa06585f9a59386a8a96c90c74bf108651a46 Mon Sep 17 00:00:00 2001 From: Manish Verma Date: Wed, 19 Oct 2016 12:08:54 +0530 Subject: [PATCH] apped plugin service provider provided plugin service provider in app/Plugins so users can install and use plugins or create their own plugin to share with community. --- .gitignore | 7 ----- app/Plugins/ServiceProvider.php | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 app/Plugins/ServiceProvider.php diff --git a/.gitignore b/.gitignore index 77f8bcf3c..c9d24e72e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,6 @@ example.env Homestead.yaml Homestead.json -/app/Plugins/Reseller/ -/app/Plugins/ServiceDesk/ -/app/Plugins/Social/ /config/lfm.php /nbproject/private/ /node_modules @@ -14,7 +11,3 @@ Homestead.json /public/uploads /public/photos/ /app/FaveoJob - -app/Plugins/ServiceDesk.zip - -app/Plugins/Social.zip diff --git a/app/Plugins/ServiceProvider.php b/app/Plugins/ServiceProvider.php new file mode 100644 index 000000000..d0eecf39f --- /dev/null +++ b/app/Plugins/ServiceProvider.php @@ -0,0 +1,46 @@ +getModule(func_get_args())) { + //$this->package('app/' . $module, $module, app_path() . '/modules/' . $module); +// $this->publishes([ +// 'app/' . $module => app_path() . '/Plugins/' . $module . '/config', +// ]); + $this->publishes([ + 'app/plugins/'.$module.'/Config/config.php' => config_path($module.'/config.php'), + ]); + } + } + + public function register() + { + if ($module = $this->getModule(func_get_args())) { + //$this->app['config']->package('app/' . $module, app_path() . '/modules/' . $module . '/config'); +// $this->publishes([ +// 'app/' . $module => app_path() . '/Plugins/' . $module . '/config', +// ]); + + $this->publishes([ + 'app/plugins/'.$module.'/Config/config.php' => config_path($module.'/config.php'), + ]); + + // Add routes + $routes = app_path().'/Plugins/'.$module.'/routes.php'; + if (file_exists($routes)) { + require $routes; + } + } + } + + public function getModule($args) + { + $module = (isset($args[0]) and is_string($args[0])) ? $args[0] : null; + + return $module; + } +}