|
8 | 8 | use Collective\Annotations\Database\Eloquent\Annotations\Scanner as ModelScanner;
|
9 | 9 | use Collective\Annotations\Events\Annotations\Scanner as EventScanner;
|
10 | 10 | use Collective\Annotations\Routing\Annotations\Scanner as RouteScanner;
|
11 |
| -use Illuminate\Container\Container; |
12 | 11 | use Illuminate\Contracts\Foundation\Application;
|
13 | 12 | use Illuminate\Support\ServiceProvider;
|
14 | 13 |
|
15 | 14 | class AnnotationsServiceProvider extends ServiceProvider
|
16 | 15 | {
|
| 16 | + use DetectsApplicationNamespace; |
| 17 | + |
17 | 18 | /**
|
18 | 19 | * The commands to be registered.
|
19 | 20 | *
|
@@ -446,7 +447,7 @@ public function routeScans()
|
446 | 447 | if ($this->scanControllers) {
|
447 | 448 | $classes = array_merge(
|
448 | 449 | $classes,
|
449 |
| - $this->getClassesFromNamespace(Container::getInstance()->getNamespace().'Http\\Controllers') |
| 450 | + $this->getClassesFromNamespace($this->getAppNamespace().'Http\\Controllers') |
450 | 451 | );
|
451 | 452 | }
|
452 | 453 |
|
@@ -477,7 +478,7 @@ public function modelScans()
|
477 | 478 | public function convertNamespaceToPath($namespace)
|
478 | 479 | {
|
479 | 480 | // remove the app namespace from the namespace if it is there
|
480 |
| - $appNamespace = Container::getInstance()->getNamespace(); |
| 481 | + $appNamespace = $this->getAppNamespace(); |
481 | 482 |
|
482 | 483 | if (substr($namespace, 0, strlen($appNamespace)) == $appNamespace) {
|
483 | 484 | $namespace = substr($namespace, strlen($appNamespace));
|
@@ -510,6 +511,6 @@ public function getClassesFromNamespace($namespace, $base = null)
|
510 | 511 | */
|
511 | 512 | protected function getAllClasses()
|
512 | 513 | {
|
513 |
| - return $this->getClassesFromNamespace(Container::getInstance()->getNamespace()); |
| 514 | + return $this->getClassesFromNamespace($this->getAppNamespace()); |
514 | 515 | }
|
515 | 516 | }
|
0 commit comments