1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 14:34:04 +00:00

Delete bindNewMailManagerInstance()

This commit is contained in:
lukinovec 2022-12-07 06:38:01 +01:00
parent 255afe33c2
commit 4d5eef3177

View file

@ -6,7 +6,6 @@ namespace Stancl\Tenancy\Bootstrappers;
use Illuminate\Config\Repository;
use Illuminate\Foundation\Application;
use Illuminate\Mail\MailManager;
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
use Stancl\Tenancy\Contracts\Tenant;
@ -47,7 +46,7 @@ class MailTenancyBootstrapper implements TenancyBootstrapper
{
// Bind fresh mail manager instance to clear the cached mailers
// So that the manager is forced to resolve the mailers with the correct credentials from the config
$this->bindNewMailManagerInstance();
$this->app->forgetInstance('mail.manager');
$this->setConfig($tenant);
}
@ -56,14 +55,7 @@ class MailTenancyBootstrapper implements TenancyBootstrapper
{
$this->unsetConfig();
$this->bindNewMailManagerInstance();
}
protected function bindNewMailManagerInstance(): void
{
$this->app->extend(MailManager::class, function (MailManager $mailManager) {
return new MailManager($this->app);
});
$this->app->forgetInstance('mail.manager');
}
protected function setConfig(Tenant $tenant): void