Unable to cache configs
Ran into a bit of a head scratcher while attempting to cache some configs today. The error I was being hit with was something I hadn't seen before.
Your configuration files are not serializable.
My issue turned out to be a pretty simple fix. I was using a Collection in a config file which, as the error clearly explains, can not be serialized.
Why? It comes down to how Laravel serializes all configs into a single config.php
file. This serialization happens in laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php
and it uses PHP's var_export and Collections are not compatible with this because they do not implement the __set_state magic method