Skip to content

Commit

Permalink
[11.x] Improves broadcasting install (#50519)
Browse files Browse the repository at this point in the history
* Improves broadcasting install

* Apply fixes from StyleCI

---------

Co-authored-by: StyleCI Bot <[email protected]>
Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
3 people authored Mar 13, 2024
1 parent bdd0acb commit cf604d2
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand Down Expand Up @@ -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\',',
Expand Down

0 comments on commit cf604d2

Please sign in to comment.