diff --git a/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php b/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php index 9eb09793fc9f..5bba27ae8395 100644 --- a/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php +++ b/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php @@ -115,7 +115,14 @@ protected function uncommentChannelsRoutesFile() */ protected function enableBroadcastServiceProvider() { - $config = ($filesystem = new Filesystem)->get(app()->configPath('app.php')); + $filesystem = new Filesystem; + + if (! $filesystem->exists(app()->configPath('app.php')) || + ! $filesystem->exists('app/Providers/BroadcastServiceProvider.php')) { + return; + } + + $config = $filesystem->get(app()->configPath('app.php')); if (str_contains($config, '// App\Providers\BroadcastServiceProvider::class')) { $filesystem->replaceInFile(