@@ -92,7 +92,7 @@ public function broadcastInsert(): PendingBroadcast
9292 return $ this ->broadcastActionTo (
9393 $ this ->broadcastDefaultStreamables (inserting: true ),
9494 $ action ,
95- Rendering::forModel ($ this ),
95+ rendering: Rendering::forModel ($ this ),
9696 );
9797 }
9898
@@ -126,58 +126,60 @@ public function broadcastRefresh(): PendingBroadcast
126126
127127 public function broadcastAppendTo ($ streamable ): PendingBroadcast
128128 {
129- return $ this ->broadcastActionTo ($ streamable , 'append ' , Rendering::forModel ($ this ));
129+ return $ this ->broadcastActionTo ($ streamable , 'append ' , rendering: Rendering::forModel ($ this ));
130130 }
131131
132132 public function broadcastPrependTo ($ streamable ): PendingBroadcast
133133 {
134- return $ this ->broadcastActionTo ($ streamable , 'prepend ' , Rendering::forModel ($ this ));
134+ return $ this ->broadcastActionTo ($ streamable , 'prepend ' , rendering: Rendering::forModel ($ this ));
135135 }
136136
137137 public function broadcastBeforeTo ($ streamable , string $ target ): PendingBroadcast
138138 {
139- return $ this ->broadcastActionTo ($ streamable , 'before ' , Rendering::forModel ($ this ), $ target );
139+ return $ this ->broadcastActionTo ($ streamable , 'before ' , $ target , rendering: Rendering::forModel ($ this ));
140140 }
141141
142142 public function broadcastAfterTo ($ streamable , string $ target ): PendingBroadcast
143143 {
144- return $ this ->broadcastActionTo ($ streamable , 'after ' , Rendering::forModel ($ this ), $ target );
144+ return $ this ->broadcastActionTo ($ streamable , 'after ' , $ target , rendering: Rendering::forModel ($ this ));
145145 }
146146
147147 public function broadcastReplaceTo ($ streamable ): PendingBroadcast
148148 {
149- return $ this ->broadcastActionTo ($ streamable , 'replace ' , Rendering::forModel ($ this ));
149+ return $ this ->broadcastActionTo ($ streamable , 'replace ' , rendering: Rendering::forModel ($ this ));
150150 }
151151
152152 public function broadcastUpdateTo ($ streamable ): PendingBroadcast
153153 {
154- return $ this ->broadcastActionTo ($ streamable , 'update ' , Rendering::forModel ($ this ));
154+ return $ this ->broadcastActionTo ($ streamable , 'update ' , rendering: Rendering::forModel ($ this ));
155155 }
156156
157157 public function broadcastRemoveTo ($ streamable ): PendingBroadcast
158158 {
159- return $ this ->broadcastActionTo ($ streamable , 'remove ' , Rendering::empty ());
159+ return $ this ->broadcastActionTo ($ streamable , 'remove ' , rendering: Rendering::empty ());
160160 }
161161
162162 public function broadcastRefreshTo ($ streamable ): PendingBroadcast
163163 {
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 ());
166167 }
167168
168169 public function asTurboStreamBroadcastingChannel ()
169170 {
170171 return $ this ->toChannels (Collection::wrap ($ this ->broadcastDefaultStreamables ($ this ->wasRecentlyCreated )));
171172 }
172173
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
174175 {
175176 return TurboStream::broadcastAction (
176177 action: $ action ,
177178 target: $ target ?: $ this ->broadcastDefaultTarget ($ action ),
178179 targets: null ,
179180 channel: $ this ->toChannels (Collection::wrap ($ streamables )),
180- content: $ rendering ,
181+ attributes: $ attributes ,
182+ content: $ rendering ?? Rendering::empty (),
181183 )->cancelIf (static ::isIgnoringTurboStreamBroadcasts ());
182184 }
183185
0 commit comments