diff --git a/app/Classes/Jobs/SendWelcomeVoucherEmail.php b/app/Classes/Jobs/SendWelcomeVoucherEmail.php index b6ef687e..77cc4ddb 100644 --- a/app/Classes/Jobs/SendWelcomeVoucherEmail.php +++ b/app/Classes/Jobs/SendWelcomeVoucherEmail.php @@ -46,10 +46,10 @@ class SendWelcomeVoucherEmail implements ShouldQueue { $currentDatetime = Carbon::now(); $dateToCompare = Carbon::parse($this->voucher->end_date); - if (!$this->user->hasAttribute($this->voucher->code."_EMAIL_COUNT") - && $this->user->rewards->where('voucher_id', $this->voucher->id)->count() > 0 - && $currentDatetime->isBefore($dateToCompare)) - { + // if (!$this->user->hasAttribute($this->voucher->code."_EMAIL_COUNT") + // && $this->user->rewards->where('voucher_id', $this->voucher->id)->count() > 0 + // && $currentDatetime->isBefore($dateToCompare)) + // { //Key #1 $keyValuePairObject = new KeyValuePairObject( $this->voucher->code."_EMAIL_COUNT", @@ -65,6 +65,6 @@ class SendWelcomeVoucherEmail implements ShouldQueue (App()->make(CreatesKeyValuePair::class))->execute($this->user, $keyValuePairObject); $this->user->notify(new WelcomeVoucherEmail($this->user, $this->voucher)); - } + //} } } diff --git a/app/Console/Commands/OneTimeTestVoucherifyEmailCommand.php b/app/Console/Commands/OneTimeTestVoucherifyEmailCommand.php new file mode 100644 index 00000000..377bf052 --- /dev/null +++ b/app/Console/Commands/OneTimeTestVoucherifyEmailCommand.php @@ -0,0 +1,90 @@ +fetchesVoucher = $fetchesVoucher; + $this->generatesEmailVerificationAttempt = $generatesEmailVerificationAttempt; + $this->sendUserVerificationEmail = $sendUserVerificationEmail; + $this->generatesPasswordReset = $generatesPasswordReset; + $this->sendResetPasswordEmail = $sendResetPasswordEmail; + } + + /** + * Execute the console command. + * + * @return mixed + */ + public function handle() + { + try{ //In case voucher got deleted unintentionally + $user = User::where('id', 3974)->first(); //5436, 3974 + + Log::info(json_encode($user)); + $voucher = $this->fetchesVoucher->execute(['code' => Vouchers::WELCOME_50_PERCENT_OFF]); + Log::info(json_encode($voucher)); + if($voucher) SendWelcomeVoucherEmail::dispatch($user, $voucher, 1); + + // $attempt = $this->generatesEmailVerificationAttempt->execute($user); + // $this->sendUserVerificationEmail::dispatch($user, $attempt); + + // $attempt = $this->generatesPasswordReset->execute($user); + // $this->sendResetPasswordEmail::dispatch($user, $attempt); + } + catch(\Exception $e){} + + } + +}