mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Add fallback package method
For L5
This commit is contained in:
@@ -65,5 +65,37 @@ class IdeHelperServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
return array('command.ide-helper.generate', 'command.ide-helper.models');
|
return array('command.ide-helper.generate', 'command.ide-helper.models');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the package's component namespaces.
|
||||||
|
*
|
||||||
|
* @param string $package
|
||||||
|
* @param string $namespace
|
||||||
|
* @param string $path
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function package($package, $namespace = null, $path = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Is it possible to register the config?
|
||||||
|
if (method_exists($this->app['config'], 'package')) {
|
||||||
|
$this->app['config']->package($package, $path.'/config', $namespace);
|
||||||
|
} else {
|
||||||
|
// Load the config for now..
|
||||||
|
$config = $this->app['files']->getRequire($path .'/config/config.php');
|
||||||
|
foreach($config as $key => $value){
|
||||||
|
$this->app['config']->set($namespace.'::'.$key, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register view files
|
||||||
|
$appView = $this->app['path']."/views/packages/{$package}";
|
||||||
|
if ($this->app['files']->isDirectory($appView))
|
||||||
|
{
|
||||||
|
$this->app['view']->addNamespace($namespace, $appView);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->app['view']->addNamespace($namespace, $path.'/views');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user