|
@@ -12,6 +12,8 @@ use App\Models\Schedule;
|
|
|
use App\Models\ServicePackage;
|
|
use App\Models\ServicePackage;
|
|
|
use App\Rules\ScheduleBusinessRules;
|
|
use App\Rules\ScheduleBusinessRules;
|
|
|
use App\Services\NotificationService;
|
|
use App\Services\NotificationService;
|
|
|
|
|
+use App\Services\PushNotificationService;
|
|
|
|
|
+use App\Notifications\Push\Prestador\Agendamento\NewPushRequest;
|
|
|
use Carbon\Carbon;
|
|
use Carbon\Carbon;
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\DB;
|
|
@@ -80,8 +82,16 @@ class ScheduleService
|
|
|
'type' => NotificationTypeEnum::SCHEDULE_PROVIDER_CLIENT_NEW_SOLICITATION->value,
|
|
'type' => NotificationTypeEnum::SCHEDULE_PROVIDER_CLIENT_NEW_SOLICITATION->value,
|
|
|
'user_id' => $newSchedule->provider->user_id,
|
|
'user_id' => $newSchedule->provider->user_id,
|
|
|
]);
|
|
]);
|
|
|
|
|
+ // Push Notification
|
|
|
|
|
+ $pushNotificationService = app(PushNotificationService::class);
|
|
|
|
|
+
|
|
|
|
|
+ $pushNotificationService->sendToUser(
|
|
|
|
|
+ $newSchedule->provider->user,
|
|
|
|
|
+ new NewPushRequest($newSchedule->client->user->name)
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
$createdSchedules[] = $newSchedule;
|
|
$createdSchedules[] = $newSchedule;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -512,7 +522,7 @@ class ScheduleService
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
DB::rollBack();
|
|
DB::rollBack();
|
|
|
|
|
|
|
|
- Log::error('Erro ao cancelar agendamento: '.$e->getMessage());
|
|
|
|
|
|
|
+ Log::error('Erro ao cancelar agendamento: ' . $e->getMessage());
|
|
|
|
|
|
|
|
throw $e;
|
|
throw $e;
|
|
|
}
|
|
}
|