edvinaskrucas / notification

Notification package for Laravel
MIT License
526 stars 98 forks source link

"Class cache does not exist" error when using Redis session driver #23

Closed jasmineleonard closed 10 years ago

jasmineleonard commented 10 years ago

I think this is caused by lines 49-51 in NotificationServiceProvider:

$this->app->bind('Krucas\Notification\Subscriber', function ($app) { return new Subscriber($app['session.store'], $app['config']); });

The NotificationServiceProvider is attempting to use the services provided by other service providers in its register method, but these other providers may not have been loaded yet. Specifically, when using the Redis session driver, the SessionManager tries to use the Cache class, but this has not yet been bound because the CacheServiceProvider has not yet been loaded.

Perhaps you could register the event subscriber in the boot method rather than the register method? That way it waits until all other providers have loaded, and therefore the cache class can be found.

rossedman commented 10 years ago

I'm getting the same error and I'm not using Redis. Just the standard Cache. Any ideas?

mikedfunk commented 10 years ago

+1 getting the same issue with memcached

mikedfunk commented 10 years ago

This should be fixed by https://github.com/edvinaskrucas/notification/pull/26