Skip to content

Commit 9f176fc

Browse files
committed
Merge branch 'jobs-batching-array-serialize'
2 parents 7a602b9 + 666d803 commit 9f176fc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Illuminate/Bus/Batch.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
use Illuminate\Collections\Arr;
77
use Illuminate\Collections\Collection;
88
use Illuminate\Contracts\Queue\Factory as QueueFactory;
9+
use Illuminate\Contracts\Support\Arrayable;
910
use JsonSerializable;
1011

11-
class Batch implements JsonSerializable
12+
class Batch implements Arrayable, JsonSerializable
1213
{
1314
/**
1415
* The queue factory implementation.
@@ -361,11 +362,11 @@ public function delete()
361362
}
362363

363364
/**
364-
* Get the JSON serializable representation of the object.
365+
* Convert the batch to an array.
365366
*
366367
* @return array
367368
*/
368-
public function jsonSerialize()
369+
public function toArray()
369370
{
370371
return [
371372
'id' => $this->id,
@@ -379,4 +380,14 @@ public function jsonSerialize()
379380
'finishedAt' => $this->finishedAt,
380381
];
381382
}
383+
384+
/**
385+
* Get the JSON serializable representation of the object.
386+
*
387+
* @return array
388+
*/
389+
public function jsonSerialize()
390+
{
391+
return $this->toArray();
392+
}
382393
}

0 commit comments

Comments
 (0)