Skip to content

Commit

Permalink
change pattern for creating new model broadcast events
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jul 21, 2021
1 parent 5ca5768 commit aca6f90
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Illuminate/Database/Eloquent/BroadcastsEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected function broadcastIfBroadcastChannelsExistForEvent($instance, $event,
*/
public function newBroadcastableModelEvent($event)
{
return tap($this->withBroadcastableEvent(new BroadcastableModelEventOccurred($this, $event)), function ($event) {
return tap($this->newBroadcastableEvent($event), function ($event) {
$event->connection = property_exists($this, 'broadcastConnection')
? $this->broadcastConnection
: $this->broadcastConnection();
Expand All @@ -140,14 +140,14 @@ public function newBroadcastableModelEvent($event)
}

/**
* Configure the broadcastable model event for the model.
* Create a new broadcastable model event for the model.
*
* @param \Illuminate\Database\Eloquent\BroadcastableModelEventOccurred $event
* @param string $event
* @return \Illuminate\Database\Eloquent\BroadcastableModelEventOccurred
*/
protected function withBroadcastableEvent(BroadcastableModelEventOccurred $event)
protected function newBroadcastableEvent($event)
{
return $event;
return new BroadcastableModelEventOccurred($this, $event);
}

/**
Expand Down

0 comments on commit aca6f90

Please sign in to comment.