@@ -205,7 +205,7 @@ public function add($jobs)
205205 */
206206 protected function prepareBatchedChain (array $ chain )
207207 {
208- return collect ( $ chain )->map (function ($ job ) {
208+ return ( new Collection ( $ chain) )->map (function ($ job ) {
209209 $ job = $ job instanceof Closure ? CallQueuedClosure::create ($ job ) : $ job ;
210210
211211 return $ job ->withBatchId ($ this ->id );
@@ -245,7 +245,7 @@ public function recordSuccessfulJob(string $jobId)
245245 if ($ this ->hasProgressCallbacks ()) {
246246 $ batch = $ this ->fresh ();
247247
248- collect ( $ this ->options ['progress ' ])->each (function ($ handler ) use ($ batch ) {
248+ ( new Collection ( $ this ->options ['progress ' ]) )->each (function ($ handler ) use ($ batch ) {
249249 $ this ->invokeHandlerCallback ($ handler , $ batch );
250250 });
251251 }
@@ -257,15 +257,15 @@ public function recordSuccessfulJob(string $jobId)
257257 if ($ counts ->pendingJobs === 0 && $ this ->hasThenCallbacks ()) {
258258 $ batch = $ this ->fresh ();
259259
260- collect ( $ this ->options ['then ' ])->each (function ($ handler ) use ($ batch ) {
260+ ( new Collection ( $ this ->options ['then ' ]) )->each (function ($ handler ) use ($ batch ) {
261261 $ this ->invokeHandlerCallback ($ handler , $ batch );
262262 });
263263 }
264264
265265 if ($ counts ->allJobsHaveRanExactlyOnce () && $ this ->hasFinallyCallbacks ()) {
266266 $ batch = $ this ->fresh ();
267267
268- collect ( $ this ->options ['finally ' ])->each (function ($ handler ) use ($ batch ) {
268+ ( new Collection ( $ this ->options ['finally ' ]) )->each (function ($ handler ) use ($ batch ) {
269269 $ this ->invokeHandlerCallback ($ handler , $ batch );
270270 });
271271 }
@@ -350,23 +350,23 @@ public function recordFailedJob(string $jobId, $e)
350350 if ($ this ->hasProgressCallbacks () && $ this ->allowsFailures ()) {
351351 $ batch = $ this ->fresh ();
352352
353- collect ( $ this ->options ['progress ' ])->each (function ($ handler ) use ($ batch , $ e ) {
353+ ( new Collection ( $ this ->options ['progress ' ]) )->each (function ($ handler ) use ($ batch , $ e ) {
354354 $ this ->invokeHandlerCallback ($ handler , $ batch , $ e );
355355 });
356356 }
357357
358358 if ($ counts ->failedJobs === 1 && $ this ->hasCatchCallbacks ()) {
359359 $ batch = $ this ->fresh ();
360360
361- collect ( $ this ->options ['catch ' ])->each (function ($ handler ) use ($ batch , $ e ) {
361+ ( new Collection ( $ this ->options ['catch ' ]) )->each (function ($ handler ) use ($ batch , $ e ) {
362362 $ this ->invokeHandlerCallback ($ handler , $ batch , $ e );
363363 });
364364 }
365365
366366 if ($ counts ->allJobsHaveRanExactlyOnce () && $ this ->hasFinallyCallbacks ()) {
367367 $ batch = $ this ->fresh ();
368368
369- collect ( $ this ->options ['finally ' ])->each (function ($ handler ) use ($ batch , $ e ) {
369+ ( new Collection ( $ this ->options ['finally ' ]) )->each (function ($ handler ) use ($ batch , $ e ) {
370370 $ this ->invokeHandlerCallback ($ handler , $ batch , $ e );
371371 });
372372 }
0 commit comments