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.
This commit is contained in:
Manish Verma
2016-10-19 12:08:54 +05:30
parent 5b0eeb5d81
commit b13fa06585
2 changed files with 46 additions and 7 deletions

7
.gitignore vendored
View File

@@ -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

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Plugins;
abstract class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
public function boot()
{
if ($module = $this->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;
}
}