Skip to content

Commit

Permalink
Merge pull request #3 from kirschbaum-development/laravel-7-swift-tra…
Browse files Browse the repository at this point in the history
…nsport

Fixes retrieving the swift mail transport from the app container in Laravel 7
  • Loading branch information
brandonferens authored Apr 10, 2020
2 parents 8c1f29a + 7587c63 commit 2e90292
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/WithMailInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public function interceptMail()
*/
public function interceptedMail(): Collection
{
return app('swift.transport')->driver()->messages();
$swiftTransport = (version_compare(app()->version(), '7.0.0', '<'))
? app('swift.transport')
: (app('mailer')->getSwiftMailer())->getTransport();

return $swiftTransport->driver()->messages();
}
}

0 comments on commit 2e90292

Please sign in to comment.