diff --git a/src/Providers/ServiceProvider.php b/src/Providers/ServiceProvider.php index 1feeb2b..4a55402 100644 --- a/src/Providers/ServiceProvider.php +++ b/src/Providers/ServiceProvider.php @@ -6,16 +6,4 @@ abstract class ServiceProvider extends BaseServiceProvider { use PackageProviderTrait; - - /** - * Boot under Laravel setup. - * - * @param string $path - * - * @return void - */ - protected function bootUsingLaravel($path) - { - // - } } diff --git a/src/Providers/Traits/PackageProviderTrait.php b/src/Providers/Traits/PackageProviderTrait.php index 17f903f..71fb105 100644 --- a/src/Providers/Traits/PackageProviderTrait.php +++ b/src/Providers/Traits/PackageProviderTrait.php @@ -16,10 +16,8 @@ trait PackageProviderTrait */ public function addConfigComponent($package, $namespace, $path) { - $config = $this->app['config']; - - if ($config instanceof PackageRepository) { - $config->package($package, $path, $namespace); + if ($this->hasPackageRepository()) { + $this->app['config']->package($package, $path, $namespace); } } @@ -143,4 +141,26 @@ protected function getAppViewPaths($package) return "{$path}/packages/{$package}"; }, $this->app['config']['view.paths']); } + + /** + * Has package repository available. + * + * @return bool + */ + protected function hasPackageRepository() + { + return ($this->app['config'] instanceof PackageRepository); + } + + /** + * Boot under Laravel setup. + * + * @param string $path + * + * @return void + */ + protected function bootUsingLaravel($path) + { + // + } }