소스 검색

fix cancelamento sobmedida que nao teve aceite de prestador ainda

Gustavo Zanatta 2 일 전
부모
커밋
eb423094e2
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      app/Services/ScheduleService.php

+ 7 - 1
app/Services/ScheduleService.php

@@ -260,13 +260,19 @@ class ScheduleService
 
                     switch (Auth::user()?->type) {
                         case UserTypeEnum::CLIENT:
+                            $user = $schedule->provider?->user;
+
+                          if(!$user) {
+                            break;
+                          }
+
                             $notificationService->create([
                                 'title'       => __('notifications.schedule_cancelled_title'),
                                 'description' => __('notifications.client_cancelled_schedule_description'),
                                 'origin'      => 'schedule',
                                 'origin_id'   => $schedule->id,
                                 'type'        => NotificationTypeEnum::SCHEDULE_PROVIDER_CLIENT_CANCELLED->value,
-                                'user_id'     => $schedule->provider->user_id,
+                                'user_id'     => $user->id,
                             ]);
                             $this->sendClientCancelledPush($schedule);