1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 14:34:04 +00:00
tenancy/src/TenancyBootstrappers/CacheTenancyBoostrapper.php
2019-09-06 16:52:16 +00:00

28 lines
643 B
PHP

<?php
declare(strict_types=1);
namespace Stancl\Tenancy\TenancyBoostrappers;
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
class CacheTenancyBoostrapper 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;
});
}
}