@@ -90,15 +90,15 @@ public function getPendingJobs(string $queueName = 'default'): array
9090 ->get ();
9191
9292 return array_map (function ($ job ) {
93- return [
94- ' id ' => $ job ->id ,
95- ' queue ' => $ job ->queue ,
96- ' payload ' => $ job ->payload ,
97- ' attempts ' => $ job ->attempts ,
98- ' available_at ' => $ job ->available_at ,
99- ' created_at ' => $ job ->created_at ,
100- ' reserved_at ' => $ job ->reserved_at ,
101- ] ;
93+ return ( new PendingJob (
94+ id: $ job ->id ,
95+ queue: $ job ->queue ,
96+ payload: $ job ->payload ,
97+ attempts: $ job ->attempts ?? 0 ,
98+ available_at: $ job ->available_at ?? 0 ,
99+ created_at: $ job ->created_at ?? 0 ,
100+ reserved_at: $ job ->reserved_at ?? 0 ,
101+ ))-> toArray () ;
102102 }, $ jobs ->toArray ());
103103 }
104104
@@ -113,14 +113,13 @@ public function getFailedJobs(string $queueName = 'default'): array
113113 ->get ();
114114
115115 return array_map (function ($ job ) {
116- return [
117- 'id ' => $ job ->id ,
118- 'uuid ' => $ job ->uuid ,
119- 'queue ' => $ job ->queue ,
120- 'payload ' => $ job ->payload ,
121- 'exception ' => $ job ->exception ,
122- 'failed_at ' => $ job ->failed_at ,
123- ];
116+ return (new FailedJob (
117+ id: $ job ->id ,
118+ uuid: $ job ->uuid ,
119+ payload: $ job ->payload ?? '' ,
120+ failed_at: $ job ->failed_at ?? '' ,
121+ exception: $ job ->exception ?? '' ,
122+ ))->toArray ();
124123 }, $ jobs ->toArray ());
125124 }
126125
0 commit comments