mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 09:24:04 +00:00
Tenant contract, Tenancy bootstrappers, drop predis
This commit is contained in:
parent
98cb49b1c0
commit
f04ca349bd
13 changed files with 158 additions and 47 deletions
26
src/TenancyBootstrappers/CacheTenancyBoostrapper.php
Normal file
26
src/TenancyBootstrappers/CacheTenancyBoostrapper.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Stancl\Tenancy\TenancyBoostrappers;
|
||||
|
||||
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
||||
|
||||
class CacheTenancyBootstrapped implements TenancyBootstrapper
|
||||
{
|
||||
/** @var \Illuminate\Cache\CacheManager */
|
||||
protected $originalCache;
|
||||
|
||||
public function start()
|
||||
{
|
||||
$this->originalCache = $this->originalCache ?? $this->app['cache'];
|
||||
$this->app->extend('cache', function () {
|
||||
return new CacheManager($this->app);
|
||||
});
|
||||
}
|
||||
|
||||
public function end()
|
||||
{
|
||||
$this->app->extend('cache', function () {
|
||||
return $this->originalCache;
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue