Skip to content

Commit

Permalink
Add Mailer::shouldBeQueued() method.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Jul 28, 2016
1 parent 0b7abd7 commit 25013cd
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ public function getMailer()
*/
public function push($view, array $data = [], $callback = null, $queue = null)
{
$method = 'queue';
$method = 'send';
$memory = $this->memory;

if (false === $memory->get('email.queue', false)) {
$method = 'send';
if ($this->shouldBeQueued()) {
$method = 'queue';
}

return $this->{$method}($view, $data, $callback, $queue);
Expand Down Expand Up @@ -197,4 +197,14 @@ protected function resolveMailer()

return $mailer;
}

/**
* Should the email be send via queue.
*
* @return bool
*/
protected function shouldBeQueued()
{
return $this->memory->get('email.queue', false);
}
}

0 comments on commit 25013cd

Please sign in to comment.