Skip to content

Commit a1f0972

Browse files
committedJun 29, 2017
fix scheduled date always set
1 parent 66c2a62 commit a1f0972

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
 

‎src/Decorators/PrepareEmail.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public function __construct(Email $email)
1616

1717
$email->variables = json_encode($email->getVariables());
1818

19-
$email->scheduled_at = $email->getScheduledDateAsCarbon()->toDateTimeString();
19+
if ($email->hasScheduledDate()) {
20+
$email->scheduled_at = $email->getScheduledDateAsCarbon()->toDateTimeString();
21+
}
2022

2123
$this->email->encrypted = config('laravel-database-emails.encrypt', false);
2224

‎src/Email.php

+10
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ public function getAttempts()
174174
return $this->attempts;
175175
}
176176

177+
/**
178+
* Determine if a scheduled date has been set.
179+
*
180+
* @return bool
181+
*/
182+
public function hasScheduledDate()
183+
{
184+
return !is_null($this->getScheduledDate());
185+
}
186+
177187
/**
178188
* Get the scheduled date as a Carbon instance.
179189
*

0 commit comments

Comments
 (0)
Please sign in to comment.