-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] Ability to specify the broadcaster to use when broadcasting an …
…event (#38086) * WIP * WIP * WIP * formatting * fix paren Co-authored-by: Taylor Otwell <[email protected]>
- Loading branch information
1 parent
a17fd16
commit f4bb259
Showing
4 changed files
with
106 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Illuminate\Broadcasting; | ||
|
||
use Illuminate\Support\Arr; | ||
|
||
trait InteractsWithBroadcasting | ||
{ | ||
/** | ||
* The broadcaster connection to use to broadcast the event. | ||
* | ||
* @var array | ||
*/ | ||
protected $broadcastConnection = [null]; | ||
|
||
/** | ||
* Broadcast the event using a specific broadcaster. | ||
* | ||
* @param array|string|null $connection | ||
* @return $this | ||
*/ | ||
public function broadcastVia($connection = null) | ||
{ | ||
$this->broadcastConnection = is_null($connection) | ||
? [null] | ||
: Arr::wrap($connection); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get the broadcaster connections the event should be broadcast on. | ||
* | ||
* @return array | ||
*/ | ||
public function broadcastConnections() | ||
{ | ||
return $this->broadcastConnection; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters