@@ -128,15 +128,17 @@ private function registerRoutes(): void
128128
129129    private  function  registerDashboard (): void 
130130    {
131-         app ('events ' )->listen (TaskCreated::class, function  (TaskCreated $ event
131+         $ events$ this app ['events ' ];
132+ 
133+         $ eventslisten (TaskCreated::class, function  (TaskCreated $ event
132134            if  (CloudTasks::dashboardDisabled ()) {
133135                return ;
134136            }
135137
136138            DashboardService::make ()->add ($ eventqueue , $ eventtask );
137139        });
138140
139-         app ( ' events ' ) ->listen (JobFailed::class, function  (JobFailed $ event
141+         $ eventslisten (JobFailed::class, function  (JobFailed $ event
140142            if  (!$ eventjob  instanceof  CloudTasksJob) {
141143                return ;
142144            }
@@ -149,52 +151,58 @@ private function registerDashboard(): void
149151            );
150152        });
151153
152-         app ( ' events ' ) ->listen (JobProcessing::class, function  (JobProcessing $ event
153-             if  (!CloudTasks:: dashboardEnabled () ) {
154+         $ eventslisten (JobProcessing::class, function  (JobProcessing $ event
155+             if  (!$ event -> job   instanceof  CloudTasksJob ) {
154156                return ;
155157            }
156158
157-             if  ($ event -> job   instanceof  CloudTasksJob ) {
159+             if  (CloudTasks:: dashboardEnabled () ) {
158160                DashboardService::make ()->markAsRunning ($ eventjob ->uuid ());
159161            }
160162        });
161163
162-         app ('events ' )->listen (JobProcessed::class, function  (JobProcessed $ event
163-             data_set ($ eventjob ->job , 'internal.processed ' , true );
164- 
165-             if  (!CloudTasks::dashboardEnabled ()) {
164+         $ eventslisten (JobProcessed::class, function  (JobProcessed $ event
165+             if  (!$ eventjob  instanceof  CloudTasksJob) {
166166                return ;
167167            }
168168
169-             if  ($ eventjob  instanceof  CloudTasksJob) {
169+             data_set ($ eventjob ->job , 'internal.processed ' , true );
170+ 
171+             if  (CloudTasks::dashboardEnabled ()) {
170172                DashboardService::make ()->markAsSuccessful ($ eventjob ->uuid ());
171173            }
172174        });
173175
174-         app ('events ' )->listen (JobExceptionOccurred::class, function  (JobExceptionOccurred $ event
175-             data_set ($ eventjob ->job , 'internal.errored ' , true );
176- 
177-             if  (!CloudTasks::dashboardEnabled ()) {
176+         $ eventslisten (JobExceptionOccurred::class, function  (JobExceptionOccurred $ event
177+             if  (!$ eventjob  instanceof  CloudTasksJob) {
178178                return ;
179179            }
180180
181-             DashboardService::make ()->markAsError ($ event
181+             data_set ($ eventjob ->job , 'internal.errored ' , true );
182+ 
183+             if  (CloudTasks::dashboardEnabled ()) {
184+                 DashboardService::make ()->markAsError ($ event
185+             }
182186        });
183187
184-         app ( ' events ' ) ->listen (JobFailed::class, function  ($ event
185-             if  (!CloudTasks:: dashboardEnabled () ) {
188+         $ eventslisten (JobFailed::class, function  ($ event
189+             if  (!$ event -> job   instanceof  CloudTasksJob ) {
186190                return ;
187191            }
188192
189-             DashboardService::make ()->markAsFailed ($ event
193+             if  (CloudTasks::dashboardEnabled ()) {
194+                 DashboardService::make ()->markAsFailed ($ event
195+             }
190196        });
191197
192-         app ( ' events ' ) ->listen (JobReleased::class, function  (JobReleased $ event
193-             if  (!CloudTasks:: dashboardEnabled () ) {
198+         $ eventslisten (JobReleased::class, function  (JobReleased $ event
199+             if  (!$ event -> job   instanceof  CloudTasksJob ) {
194200                return ;
195201            }
196202
197-             DashboardService::make ()->markAsReleased ($ event
203+             if  (CloudTasks::dashboardEnabled ()) {
204+                 DashboardService::make ()->markAsReleased ($ event
205+             }
198206        });
199207    }
200208}
0 commit comments