diff --git a/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php b/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php index d479c5730366..b42987be7676 100644 --- a/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php +++ b/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php @@ -49,10 +49,10 @@ public function handle() $this->components->info("Published 'channels' route file."); copy(__DIR__.'/stubs/broadcasting-routes.stub', $broadcastingRoutesPath); - - $this->uncommentChannelsRoutesFile(); } + $this->uncommentChannelsRoutesFile(); + // Install bootstrapping... if (! file_exists($echoScriptPath = $this->laravel->resourcePath('js/echo.js'))) { copy(__DIR__.'/stubs/echo-js.stub', $echoScriptPath); @@ -63,7 +63,7 @@ public function handle() $bootstrapScriptPath ); - if (! str_contains($bootstrapScript, '/echo')) { + if (! str_contains($bootstrapScript, './echo')) { file_put_contents( $bootstrapScriptPath, trim($bootstrapScript.PHP_EOL.file_get_contents(__DIR__.'/stubs/echo-bootstrap-js.stub')).PHP_EOL, @@ -93,6 +93,8 @@ protected function uncommentChannelsRoutesFile() 'channels: ', $appBootstrapPath, ); + } elseif (str_contains($content, 'channels: ')) { + return; } elseif (str_contains($content, 'commands: __DIR__.\'/../routes/console.php\',')) { (new Filesystem)->replaceInFile( 'commands: __DIR__.\'/../routes/console.php\',',