From 527237d551905f227cc1107dcbc15ef3d0ae4efa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Wed, 17 Jan 2024 14:57:47 +0100 Subject: [PATCH] Attemp to fix notifications https://ldc-services-web.sentry.io/issues/4806040997/?environment=production&project=4506512363159552&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=14d&stream_index=0 --- app/Notifications/Customer/DestroyCustomer.php | 1 + app/Notifications/Customer/DestroyedCustomer.php | 4 +++- app/Notifications/Customer/HasSubmitedWinProof.php | 6 +++--- app/Notifications/Customer/HasWonDiscount.php | 6 +++--- app/Notifications/Customer/HasWonInstantWin.php | 7 ++++--- app/Notifications/Customer/PrizeHasBeenSent.php | 6 +++--- app/Notifications/Customer/ResetPassword.php | 2 +- app/Notifications/Customer/UpdateEmail.php | 1 + app/Notifications/Customer/UpdatePassword.php | 1 + app/Notifications/Customer/VerifyEmail.php | 2 +- 10 files changed, 21 insertions(+), 15 deletions(-) diff --git a/app/Notifications/Customer/DestroyCustomer.php b/app/Notifications/Customer/DestroyCustomer.php index eff184d..52b373c 100644 --- a/app/Notifications/Customer/DestroyCustomer.php +++ b/app/Notifications/Customer/DestroyCustomer.php @@ -32,6 +32,7 @@ class DestroyCustomer extends Notification /** @var \App\Models\Settings */ $settings = app(Settings::class); + /** @var \App\Models\Customer $notifiable */ /** @var string $first_name */ $first_name = $notifiable->api_data->firstname; diff --git a/app/Notifications/Customer/DestroyedCustomer.php b/app/Notifications/Customer/DestroyedCustomer.php index a4035c0..994fd76 100644 --- a/app/Notifications/Customer/DestroyedCustomer.php +++ b/app/Notifications/Customer/DestroyedCustomer.php @@ -30,10 +30,12 @@ class DestroyedCustomer extends Notification */ public function toMail(object $notifiable): MailMessage { + // phpcs:enable /** @var \App\Models\Settings */ $settings = app(Settings::class); - // phpcs:enable + /** @var \App\Models\Customer $notifiable */ + return (new MailMessage()) ->subject(trans('Votre compte est suprimé - :site_name', [ 'site_name' => $settings->name diff --git a/app/Notifications/Customer/HasSubmitedWinProof.php b/app/Notifications/Customer/HasSubmitedWinProof.php index cd28426..4a0e97a 100644 --- a/app/Notifications/Customer/HasSubmitedWinProof.php +++ b/app/Notifications/Customer/HasSubmitedWinProof.php @@ -3,7 +3,6 @@ namespace App\Notifications\Customer; use App\Mail\Won\WinningProofSubmitedMail; -use App\Models\Customer; use App\Models\Settings; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Mail\Mailable; @@ -42,13 +41,14 @@ class HasSubmitedWinProof extends Notification implements ShouldQueue /** * Get the mail representation of the notification. * - * @param \App\Models\Customer $notifiable + * @param object $notifiable * @return \Illuminate\Contracts\Mail\Mailable */ - public function toMail(Customer $notifiable): Mailable + public function toMail(object $notifiable): Mailable { /** @var \App\Models\Settings */ $settings = app(Settings::class); + /** @var \App\Models\Customer $notifiable */ return (new WinningProofSubmitedMail( new Address( $notifiable->email, diff --git a/app/Notifications/Customer/HasWonDiscount.php b/app/Notifications/Customer/HasWonDiscount.php index 254c08a..4418de7 100644 --- a/app/Notifications/Customer/HasWonDiscount.php +++ b/app/Notifications/Customer/HasWonDiscount.php @@ -4,7 +4,6 @@ namespace App\Notifications\Customer; use App\Lib\Discount as LibDiscount; use App\Mail\Won\DiscountWonMail; -use App\Models\Customer; use App\Models\Discount; use App\Models\Settings; use Illuminate\Bus\Queueable; @@ -48,13 +47,14 @@ class HasWonDiscount extends Notification implements ShouldQueue /** * Get the mail representation of the notification. * - * @param \App\Models\Customer $notifiable + * @param object $notifiable * @return \Illuminate\Contracts\Mail\Mailable */ - public function toMail(Customer $notifiable): Mailable + public function toMail(object $notifiable): Mailable { /** @var \App\Models\Settings */ $settings = app(Settings::class); + /** @var \App\Models\Customer $notifiable */ return (new DiscountWonMail( new Address( $notifiable->email, diff --git a/app/Notifications/Customer/HasWonInstantWin.php b/app/Notifications/Customer/HasWonInstantWin.php index adc3a05..7a48b5a 100644 --- a/app/Notifications/Customer/HasWonInstantWin.php +++ b/app/Notifications/Customer/HasWonInstantWin.php @@ -3,7 +3,6 @@ namespace App\Notifications\Customer; use App\Mail\Won\PrizeWonMail; -use App\Models\Customer; use App\Models\Prize; use App\Models\Settings; use Illuminate\Bus\Queueable; @@ -25,6 +24,7 @@ class HasWonInstantWin extends Notification implements ShouldQueue */ public function __construct(protected Prize $prize, protected string $first_name) { + $this->prize = $prize->withoutRelations(); } /** @@ -43,13 +43,14 @@ class HasWonInstantWin extends Notification implements ShouldQueue /** * Get the mail representation of the notification. * - * @param \App\Models\Customer $notifiable + * @param object $notifiable * @return \Illuminate\Contracts\Mail\Mailable */ - public function toMail(Customer $notifiable): Mailable + public function toMail(object $notifiable): Mailable { /** @var \App\Models\Settings */ $settings = app(Settings::class); + /** @var \App\Models\Customer $notifiable */ return (new PrizeWonMail( new Address( $notifiable->email, diff --git a/app/Notifications/Customer/PrizeHasBeenSent.php b/app/Notifications/Customer/PrizeHasBeenSent.php index 2763d4b..b494880 100644 --- a/app/Notifications/Customer/PrizeHasBeenSent.php +++ b/app/Notifications/Customer/PrizeHasBeenSent.php @@ -3,7 +3,6 @@ namespace App\Notifications\Customer; use App\Mail\Won\PrizeIsSentMail; -use App\Models\Customer; use App\Models\Settings; use Illuminate\Contracts\Mail\Mailable; use Illuminate\Mail\Mailables\Address; @@ -27,13 +26,14 @@ class PrizeHasBeenSent extends Notification /** * Get the mail representation of the notification. * - * @param \App\Models\Customer $notifiable + * @param object $notifiable * @return \Illuminate\Contracts\Mail\Mailable */ - public function toMail(Customer $notifiable): Mailable + public function toMail(object $notifiable): Mailable { /** @var \App\Models\Settings */ $settings = app(Settings::class); + /** @var \App\Models\Customer $notifiable */ return (new PrizeIsSentMail( new Address( $notifiable->email diff --git a/app/Notifications/Customer/ResetPassword.php b/app/Notifications/Customer/ResetPassword.php index 8ae445e..f0a5ecd 100644 --- a/app/Notifications/Customer/ResetPassword.php +++ b/app/Notifications/Customer/ResetPassword.php @@ -51,7 +51,7 @@ class ResetPassword extends NotificationsResetPassword /** @var \App\Models\Settings */ $settings = app(Settings::class); - /** @var \App\Models\Customer\Customer $notifiable */ + /** @var \App\Models\Customer $notifiable */ $resetUrl = $this->resetUrl($notifiable); /** @var string $first_name */ $first_name = $notifiable->api_data->firstname; diff --git a/app/Notifications/Customer/UpdateEmail.php b/app/Notifications/Customer/UpdateEmail.php index 8163027..b321fd2 100644 --- a/app/Notifications/Customer/UpdateEmail.php +++ b/app/Notifications/Customer/UpdateEmail.php @@ -32,6 +32,7 @@ class UpdateEmail extends Notification /** @var \App\Models\Settings */ $settings = app(Settings::class); + /** @var \App\Models\Customer $notifiable */ /** @var string $first_name */ $first_name = $notifiable->api_data->firstname; diff --git a/app/Notifications/Customer/UpdatePassword.php b/app/Notifications/Customer/UpdatePassword.php index 23a20c5..804af58 100644 --- a/app/Notifications/Customer/UpdatePassword.php +++ b/app/Notifications/Customer/UpdatePassword.php @@ -32,6 +32,7 @@ class UpdatePassword extends Notification /** @var \App\Models\Settings */ $settings = app(Settings::class); + /** @var \App\Models\Customer $notifiable */ /** @var string $first_name */ $first_name = $notifiable->api_data->firstname; diff --git a/app/Notifications/Customer/VerifyEmail.php b/app/Notifications/Customer/VerifyEmail.php index c17eb6f..1acceda 100644 --- a/app/Notifications/Customer/VerifyEmail.php +++ b/app/Notifications/Customer/VerifyEmail.php @@ -51,7 +51,7 @@ class VerifyEmail extends NotificationsVerifyEmail /** @var \App\Models\Settings */ $settings = app(Settings::class); - /** @var \App\Models\Customer\Customer $notifiable */ + /** @var \App\Models\Customer $notifiable */ /** @var string $verificationUrl */ $verificationUrl = $this->verificationUrl($notifiable); /** @var string $first_name */