Переглянути джерело

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);