|
8 | 8 | use Cycle\Database\DatabaseManager; |
9 | 9 | use Cycle\Database\DatabaseProviderInterface; |
10 | 10 | use Cycle\ORM\SchemaInterface; |
| 11 | +use Illuminate\Contracts\Config\Repository as IlluminateConfig; |
11 | 12 | use Illuminate\Support\ServiceProvider; |
12 | 13 | use WayOfDev\Cycle\Config; |
13 | 14 | use WayOfDev\Cycle\Contracts\Config\Repository as ConfigRepository; |
@@ -51,19 +52,21 @@ private function registerConsoleCommands(): void |
51 | 52 |
|
52 | 53 | private function registerAdapterConfig(): void |
53 | 54 | { |
54 | | - $this->app->singleton(ConfigRepository::class, static function (): ConfigRepository { |
55 | | - return Config::fromArray( |
56 | | - config('cycle') |
57 | | - ); |
| 55 | + $this->app->singleton(ConfigRepository::class, static function ($app): ConfigRepository { |
| 56 | + /** @var IlluminateConfig $config */ |
| 57 | + $config = $app[IlluminateConfig::class]; |
| 58 | + |
| 59 | + return Config::fromArray($config->get('cycle')); |
58 | 60 | }); |
59 | 61 | } |
60 | 62 |
|
61 | 63 | private function registerDatabaseConfig(): void |
62 | 64 | { |
63 | | - $this->app->singleton(DatabaseConfig::class, static function (): DatabaseConfig { |
64 | | - return new DatabaseConfig( |
65 | | - config('cycle.database') |
66 | | - ); |
| 65 | + $this->app->singleton(DatabaseConfig::class, static function ($app): DatabaseConfig { |
| 66 | + /** @var IlluminateConfig $config */ |
| 67 | + $config = $app[IlluminateConfig::class]; |
| 68 | + |
| 69 | + return new DatabaseConfig($config->get('cycle.database')); |
67 | 70 | }); |
68 | 71 | } |
69 | 72 |
|
@@ -91,6 +94,4 @@ private function registerDatabaseSchema(): void |
91 | 94 | return $app[SchemaManagerContract::class]->create(); |
92 | 95 | }); |
93 | 96 | } |
94 | | - |
95 | | - |
96 | 97 | } |
0 commit comments