@@ -92,7 +92,7 @@ public function broadcastInsert(): PendingBroadcast
92
92
return $ this ->broadcastActionTo (
93
93
$ this ->broadcastDefaultStreamables (inserting: true ),
94
94
$ action ,
95
- Rendering::forModel ($ this ),
95
+ rendering: Rendering::forModel ($ this ),
96
96
);
97
97
}
98
98
@@ -126,58 +126,60 @@ public function broadcastRefresh(): PendingBroadcast
126
126
127
127
public function broadcastAppendTo ($ streamable ): PendingBroadcast
128
128
{
129
- return $ this ->broadcastActionTo ($ streamable , 'append ' , Rendering::forModel ($ this ));
129
+ return $ this ->broadcastActionTo ($ streamable , 'append ' , rendering: Rendering::forModel ($ this ));
130
130
}
131
131
132
132
public function broadcastPrependTo ($ streamable ): PendingBroadcast
133
133
{
134
- return $ this ->broadcastActionTo ($ streamable , 'prepend ' , Rendering::forModel ($ this ));
134
+ return $ this ->broadcastActionTo ($ streamable , 'prepend ' , rendering: Rendering::forModel ($ this ));
135
135
}
136
136
137
137
public function broadcastBeforeTo ($ streamable , string $ target ): PendingBroadcast
138
138
{
139
- return $ this ->broadcastActionTo ($ streamable , 'before ' , Rendering::forModel ($ this ), $ target );
139
+ return $ this ->broadcastActionTo ($ streamable , 'before ' , $ target , rendering: Rendering::forModel ($ this ));
140
140
}
141
141
142
142
public function broadcastAfterTo ($ streamable , string $ target ): PendingBroadcast
143
143
{
144
- return $ this ->broadcastActionTo ($ streamable , 'after ' , Rendering::forModel ($ this ), $ target );
144
+ return $ this ->broadcastActionTo ($ streamable , 'after ' , $ target , rendering: Rendering::forModel ($ this ));
145
145
}
146
146
147
147
public function broadcastReplaceTo ($ streamable ): PendingBroadcast
148
148
{
149
- return $ this ->broadcastActionTo ($ streamable , 'replace ' , Rendering::forModel ($ this ));
149
+ return $ this ->broadcastActionTo ($ streamable , 'replace ' , rendering: Rendering::forModel ($ this ));
150
150
}
151
151
152
152
public function broadcastUpdateTo ($ streamable ): PendingBroadcast
153
153
{
154
- return $ this ->broadcastActionTo ($ streamable , 'update ' , Rendering::forModel ($ this ));
154
+ return $ this ->broadcastActionTo ($ streamable , 'update ' , rendering: Rendering::forModel ($ this ));
155
155
}
156
156
157
157
public function broadcastRemoveTo ($ streamable ): PendingBroadcast
158
158
{
159
- return $ this ->broadcastActionTo ($ streamable , 'remove ' , Rendering::empty ());
159
+ return $ this ->broadcastActionTo ($ streamable , 'remove ' , rendering: Rendering::empty ());
160
160
}
161
161
162
162
public function broadcastRefreshTo ($ streamable ): PendingBroadcast
163
163
{
164
- return TurboStream::broadcastRefresh ($ this ->toChannels (Collection::wrap ($ streamable )))
165
- ->cancelIf (fn () => static ::isIgnoringTurboStreamBroadcasts ());
164
+ return TurboStream::broadcastRefresh (
165
+ $ this ->toChannels (Collection::wrap ($ streamable ))
166
+ )->cancelIf (fn () => static ::isIgnoringTurboStreamBroadcasts ());
166
167
}
167
168
168
169
public function asTurboStreamBroadcastingChannel ()
169
170
{
170
171
return $ this ->toChannels (Collection::wrap ($ this ->broadcastDefaultStreamables ($ this ->wasRecentlyCreated )));
171
172
}
172
173
173
- protected function broadcastActionTo ($ streamables , string $ action , Rendering $ rendering , ? string $ target = null ): PendingBroadcast
174
+ public function broadcastActionTo ($ streamables , string $ action , ? string $ target = null , array $ attributes = [], ? Rendering $ rendering = null ): PendingBroadcast
174
175
{
175
176
return TurboStream::broadcastAction (
176
177
action: $ action ,
177
178
target: $ target ?: $ this ->broadcastDefaultTarget ($ action ),
178
179
targets: null ,
179
180
channel: $ this ->toChannels (Collection::wrap ($ streamables )),
180
- content: $ rendering ,
181
+ attributes: $ attributes ,
182
+ content: $ rendering ?? Rendering::empty (),
181
183
)->cancelIf (static ::isIgnoringTurboStreamBroadcasts ());
182
184
}
183
185
0 commit comments