mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 03:54:03 +00:00
[1.7.0] Add Events system (#93)
* Add TenantManagerEvents * Apply fixes from StyleCI * Fix typos, add tests * end() events
This commit is contained in:
parent
d7358c588c
commit
c1df467601
3 changed files with 149 additions and 0 deletions
|
|
@ -9,6 +9,8 @@ use Stancl\Tenancy\Exceptions\PhpRedisNotInstalledException;
|
|||
|
||||
trait BootstrapsTenancy
|
||||
{
|
||||
use TenantManagerEvents;
|
||||
|
||||
public $originalSettings = [];
|
||||
/**
|
||||
* Was tenancy initialized/bootstrapped?
|
||||
|
|
@ -19,6 +21,10 @@ trait BootstrapsTenancy
|
|||
|
||||
public function bootstrap()
|
||||
{
|
||||
array_map(function ($listener) {
|
||||
$listener($this);
|
||||
}, $this->listeners['bootstrapping']);
|
||||
|
||||
$this->initialized = true;
|
||||
|
||||
$this->switchDatabaseConnection();
|
||||
|
|
@ -27,6 +33,10 @@ trait BootstrapsTenancy
|
|||
}
|
||||
$this->tagCache();
|
||||
$this->suffixFilesystemRootPaths();
|
||||
|
||||
array_map(function ($listener) {
|
||||
$listener($this);
|
||||
}, $this->listeners['bootstrapped']);
|
||||
}
|
||||
|
||||
public function end()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue