Yes, I used one of those clickbait titles and no I'm not ashamed, not at all, because now that you've clicked you might as well read it, you obviously have no better things to do.
While working for a client whose codebase had a lot of legacy code I faced an interesting challenge, I needed to change the database connection on an already instantiated query builder, and I couldn't do it the Laravel way.
Improve Laravel performance with this simple trick!
There are two approaches to sharing data across views in Laravel, view share and view composer. In this tuts I will give you a brief overview of both of them and more importantly what you should be careful about when using composer. Now, let's dive in.