2019-12-30 22:59:12 +01:00
|
|
|
<?php
|
2019-12-04 05:52:04 +01:00
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
use App\Helpers\Mail\GmailTransportManager;
|
2021-02-22 04:39:53 +01:00
|
|
|
use Coconuts\Mail\PostmarkTransport;
|
2019-12-04 05:52:04 +01:00
|
|
|
use Illuminate\Mail\MailServiceProvider as MailProvider;
|
2021-02-10 12:34:39 +01:00
|
|
|
use Illuminate\Mail\TransportManager;
|
2021-02-22 04:39:53 +01:00
|
|
|
use GuzzleHttp\Client as HttpClient;
|
2019-12-04 05:52:04 +01:00
|
|
|
|
|
|
|
class MailServiceProvider extends MailProvider
|
|
|
|
{
|
2021-02-10 12:06:10 +01:00
|
|
|
|
|
|
|
public function register()
|
|
|
|
{
|
2021-02-10 12:17:27 +01:00
|
|
|
$this->registerIlluminateMailer();
|
2021-02-10 12:06:10 +01:00
|
|
|
}
|
|
|
|
|
2021-02-10 12:34:39 +01:00
|
|
|
protected function registerIlluminateMailer()
|
2019-12-04 05:52:04 +01:00
|
|
|
{
|
2021-04-07 00:56:36 +02:00
|
|
|
// $this->app->singleton('mail.manager', function($app) {
|
|
|
|
// return new GmailTransportManager($app);
|
|
|
|
// });
|
|
|
|
|
|
|
|
$this->app->bind('mail.manager', function($app) {
|
2021-02-10 12:34:39 +01:00
|
|
|
return new GmailTransportManager($app);
|
|
|
|
});
|
2021-04-07 00:56:36 +02:00
|
|
|
|
2021-02-10 12:34:39 +01:00
|
|
|
$this->app->bind('mailer', function ($app) {
|
|
|
|
return $app->make('mail.manager')->mailer();
|
2019-12-04 05:52:04 +01:00
|
|
|
});
|
2021-02-10 12:34:39 +01:00
|
|
|
|
2021-02-22 04:39:53 +01:00
|
|
|
$this->app['mail.manager']->extend('postmark', function () {
|
|
|
|
return new PostmarkTransport(
|
|
|
|
$this->guzzle(config('postmark.guzzle', [])),
|
|
|
|
config('postmark.secret', config('services.postmark.secret'))
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function guzzle(array $config): HttpClient
|
|
|
|
{
|
|
|
|
return new HttpClient($config);
|
|
|
|
}
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|
2021-02-10 12:34:39 +01:00
|
|
|
|