From b4b202663558c20c322a49bd65433b8fb1d4d68e Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 25 Apr 2017 17:58:55 +0300 Subject: [PATCH] Fix for tests --- app/Jobs/SendInvoiceEmail.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Jobs/SendInvoiceEmail.php b/app/Jobs/SendInvoiceEmail.php index 09a282f38238..a9a693133888 100644 --- a/app/Jobs/SendInvoiceEmail.php +++ b/app/Jobs/SendInvoiceEmail.php @@ -9,6 +9,7 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Monolog\Logger; use Auth; +use App; /** * Class SendInvoiceEmail. @@ -61,13 +62,13 @@ class SendInvoiceEmail extends Job implements ShouldQueue public function handle(ContactMailer $mailer) { // send email as user - if ($this->userId) { + if (App::runningInConsole() && $this->userId) { Auth::loginUsingId($this->userId); } $mailer->sendInvoice($this->invoice, $this->reminder, $this->template); - if ($this->userId) { + if (App::runningInConsole() && $this->userId) { Auth::logout(); } }