Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Mail;
4
 
5
use Illuminate\Contracts\Support\DeferrableProvider;
6
use Illuminate\Support\ServiceProvider;
7
 
8
class MailServiceProvider extends ServiceProvider implements DeferrableProvider
9
{
10
    /**
11
     * Register the service provider.
12
     *
13
     * @return void
14
     */
15
    public function register()
16
    {
17
        $this->registerIlluminateMailer();
18
        $this->registerMarkdownRenderer();
19
    }
20
 
21
    /**
22
     * Register the Illuminate mailer instance.
23
     *
24
     * @return void
25
     */
26
    protected function registerIlluminateMailer()
27
    {
28
        $this->app->singleton('mail.manager', function ($app) {
29
            return new MailManager($app);
30
        });
31
 
32
        $this->app->bind('mailer', function ($app) {
33
            return $app->make('mail.manager')->mailer();
34
        });
35
    }
36
 
37
    /**
38
     * Register the Markdown renderer instance.
39
     *
40
     * @return void
41
     */
42
    protected function registerMarkdownRenderer()
43
    {
44
        if ($this->app->runningInConsole()) {
45
            $this->publishes([
46
                __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/mail'),
47
            ], 'laravel-mail');
48
        }
49
 
50
        $this->app->singleton(Markdown::class, function ($app) {
51
            $config = $app->make('config');
52
 
53
            return new Markdown($app->make('view'), [
54
                'theme' => $config->get('mail.markdown.theme', 'default'),
55
                'paths' => $config->get('mail.markdown.paths', []),
56
            ]);
57
        });
58
    }
59
 
60
    /**
61
     * Get the services provided by the provider.
62
     *
63
     * @return array
64
     */
65
    public function provides()
66
    {
67
        return [
68
            'mail.manager',
69
            'mailer',
70
            Markdown::class,
71
        ];
72
    }
73
}