Laravel cache.store does not exist
I've written some custom packages for Laravel/Lumen that we use internally where I work. I had originally written this package in Lumen and assumed that it would work in Laravel. An assumtion was incorrect.
When a colleague of mine went to use the package in Laravel 5.1, Laravel was saying that "the class cache.store" does not exist. Quick Google search revealed that other people had this problem with 5.1, and it was something to do with the cache contract not being injectable. I made a branch of my package to test this theory, and when using the Cache facade, it worked.
A few more trial and errors later, the same issue was happening on Laravel 5.2. I realised that eventually, I was trying to make a class (
app('class')) in the
register function, instead of the
boot function of my service provider in my custom package. The cache class hadn't been bound to the container yet! Weird that it worked in Lumen though...
TL;DR: make sure that if you need to make classes in your service provider, you do it in the boot function not the register function.