laravel-dkim icon indicating copy to clipboard operation
laravel-dkim copied to clipboard

parent::registerMarkdownRenderer();

Open maxlen opened this issue 5 years ago • 2 comments

Please add to src/DkimMailServiceProvider.php row: parent::registerMarkdownRenderer();

It needs for support themes

maxlen avatar Dec 20 '19 14:12 maxlen

`<?php

namespace Vitalybaev\LaravelDkim;

use Illuminate\Mail\MailServiceProvider;

class DkimMailServiceProvider extends MailServiceProvider { /** * Register the service provider. * * @return void */ public function register() { parent::registerSwiftMailer(); parent::registerMarkdownRenderer();

    $this->app->singleton('mailer', function ($app) {
        // 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']
        );

        $mailer->setQueue(app('queue'));
        
        if (method_exists($this, 'setMailerDependencies')) {
            $this->setMailerDependencies($mailer, $app);
        }

        // If a "from" address is set, we will set it on the mailer so that all mail
        // messages sent by the applications will utilize the same "from" address
        // on each one, which makes the developer's life a lot more convenient.
        $from = $app['config']['mail.from'];

        if (is_array($from) && isset($from['address'])) {
            $mailer->alwaysFrom($from['address'], $from['name']);
        }

        $to = $app['config']['mail.to'];

        if (is_array($to) && isset($to['address'])) {
            $mailer->alwaysTo($to['address'], $to['name']);
        }

        return $mailer;
    });
}

}`

maxlen avatar Dec 20 '19 14:12 maxlen

It's probably a better idea to rename DkimMailServiceProvider's public function register() to protected function registerIlluminateMailer() and drop the call(s) to parent for registering swiftmailer and markdown (wich are then taken care of by the parent's register() method.

sanderkruger avatar Mar 12 '20 14:03 sanderkruger