Skip to content

Commit

Permalink
work around php bug
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 17, 2018
1 parent 881be81 commit 36d3436
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/Illuminate/Mail/MailServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ class MailServiceProvider extends ServiceProvider
public function register()
{
$this->registerSwiftMailer();

$this->registerIlluminateMailer();

$this->registerMarkdownRenderer();
}

Expand All @@ -38,18 +36,20 @@ public function register()
*/
protected function registerIlluminateMailer()
{
$this->app->singleton('mailer', function ($app) {
$config = $app->make('config')->get('mail');
$this->app->singleton('mailer', function () {
$config = $this->app->make('config')->get('mail');

// Once we have create the mailer instance, we will set a container instance
// on the mailer. This allows us to resolve mailer classes via containers
// for maximum testability on said classes instead of passing Closures.
$mailer = new Mailer(
$app['view'], $app['swift.mailer'], $app['events']
$this->app['view'],
$this->app['swift.mailer'],
$this->app['events']
);

if ($app->bound('queue')) {
$mailer->setQueue($app['queue']);
if ($this->app->bound('queue')) {
$mailer->setQueue($this->app['queue']);
}

// Next we will set all of the global addresses on this mailer, which allows
Expand Down Expand Up @@ -92,14 +92,14 @@ public function registerSwiftMailer()
// Once we have the transporter registered, we will register the actual Swift
// mailer instance, passing in the transport instances, which allows us to
// override this transporter instances during app start-up if necessary.
$this->app->singleton('swift.mailer', function ($app) {
if ($domain = $app->make('config')->get('mail.domain')) {
$this->app->singleton('swift.mailer', function () {
if ($domain = $this->app->make('config')->get('mail.domain')) {
Swift_DependencyContainer::getInstance()
->register('mime.idgenerator.idright')
->asValue($domain);
}

return new Swift_Mailer($app['swift.transport']->driver());
return new Swift_Mailer($this->app['swift.transport']->driver());
});
}

Expand All @@ -110,8 +110,8 @@ public function registerSwiftMailer()
*/
protected function registerSwiftTransport()
{
$this->app->singleton('swift.transport', function ($app) {
return new TransportManager($app);
$this->app->singleton('swift.transport', function () {
return new TransportManager($this->app);
});
}

Expand All @@ -128,10 +128,10 @@ protected function registerMarkdownRenderer()
], 'laravel-mail');
}

$this->app->singleton(Markdown::class, function ($app) {
$config = $app->make('config');
$this->app->singleton(Markdown::class, function () {
$config = $this->app->make('config');

return new Markdown($app->make('view'), [
return new Markdown($this->app->make('view'), [
'theme' => $config->get('mail.markdown.theme', 'default'),
'paths' => $config->get('mail.markdown.paths', []),
]);
Expand Down

0 comments on commit 36d3436

Please sign in to comment.