Skip to content

Commit

Permalink
Adjusts installation process (#1353)
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro authored Nov 30, 2023
1 parent 89b88c5 commit 1a07d61
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ protected function registerHorizonServiceProvider()
{
$namespace = Str::replaceLast('\\', '', $this->laravel->getNamespace());

if (file_exists(config_path('app.php'))) {
if (file_exists($this->laravel->bootstrapPath('providers.php'))) {
// @phpstan-ignore-next-line
ServiceProvider::addProviderToBootstrapFile("{$namespace}\\Providers\\HorizonServiceProvider");
} else {
$appConfig = file_get_contents(config_path('app.php'));

if (Str::contains($appConfig, $namespace.'\\Providers\\HorizonServiceProvider::class')) {
Expand All @@ -64,9 +67,6 @@ protected function registerHorizonServiceProvider()
"{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL." {$namespace}\Providers\HorizonServiceProvider::class,".PHP_EOL,
$appConfig
));
} else {
// @phpstan-ignore-next-line
ServiceProvider::addProviderToBootstrapFile("{$namespace}\\Providers\\HorizonServiceProvider");
}

file_put_contents(app_path('Providers/HorizonServiceProvider.php'), str_replace(
Expand Down

0 comments on commit 1a07d61

Please sign in to comment.