mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 18:34:04 +00:00
Bind original BroadcastManager again on revert()
This commit is contained in:
parent
fea370d813
commit
2ed918406d
1 changed files with 6 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ use Illuminate\Foundation\Application;
|
||||||
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
||||||
use Stancl\Tenancy\Contracts\Tenant;
|
use Stancl\Tenancy\Contracts\Tenant;
|
||||||
use Stancl\Tenancy\TenancyBroadcastManager;
|
use Stancl\Tenancy\TenancyBroadcastManager;
|
||||||
|
use Illuminate\Broadcasting\Broadcasters\Broadcaster;
|
||||||
|
|
||||||
class BroadcastTenancyBootstrapper implements TenancyBootstrapper
|
class BroadcastTenancyBootstrapper implements TenancyBootstrapper
|
||||||
{
|
{
|
||||||
|
|
@ -26,6 +27,7 @@ class BroadcastTenancyBootstrapper implements TenancyBootstrapper
|
||||||
public static string|null $broadcaster = null;
|
public static string|null $broadcaster = null;
|
||||||
|
|
||||||
protected array $originalConfig = [];
|
protected array $originalConfig = [];
|
||||||
|
protected Broadcaster|null $originalBroadcastManager = null;
|
||||||
|
|
||||||
public static array $mapPresets = [
|
public static array $mapPresets = [
|
||||||
'pusher' => [
|
'pusher' => [
|
||||||
|
|
@ -52,6 +54,8 @@ class BroadcastTenancyBootstrapper implements TenancyBootstrapper
|
||||||
{
|
{
|
||||||
$this->setConfig($tenant);
|
$this->setConfig($tenant);
|
||||||
|
|
||||||
|
$this->originalBroadcastManager = $this->app->make(BroadcastManager::class);
|
||||||
|
|
||||||
$this->app->extend(BroadcastManager::class, function (BroadcastManager $broadcastManager) {
|
$this->app->extend(BroadcastManager::class, function (BroadcastManager $broadcastManager) {
|
||||||
$tenancyBroadcastManager = new TenancyBroadcastManager($this->app);
|
$tenancyBroadcastManager = new TenancyBroadcastManager($this->app);
|
||||||
|
|
||||||
|
|
@ -61,6 +65,8 @@ class BroadcastTenancyBootstrapper implements TenancyBootstrapper
|
||||||
|
|
||||||
public function revert(): void
|
public function revert(): void
|
||||||
{
|
{
|
||||||
|
$this->app->singleton(BroadcastManager::class, fn(Application $app) => $this->originalBroadcastManager);
|
||||||
|
|
||||||
$this->unsetConfig();
|
$this->unsetConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue