I created a service provider that overrides Laravel's Cache:
protected $defer = true;
public function register()
{
$this->app->singleton('cache', function ($app) {
return new CustomCacheManager($app);
});
}
public function provides()
{
return ['cache'];
}
If I run a call that constructs the cache like Cache::
or app('cache')
in a request that outputs to the browser, all works fine and my own implementation of CustomCacheManager is working.
However in event listeners or even in artisan tinker
my override isn't working and Laravel's own core class is being used.
Am I doing something wrong here? How can I make the override persistent across the whole application?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire