But instead of exporting variables in the controller our package does it in the view.
Laravel Daily posted a new tip today, they explain why you shouldn’t set global variables in Base Controller.
Setting global variables in the base controller works, until you need to add a error page or 404 page. When rendering those pages no controller will ever be hit. So your global variables are not available at that moment.
For the workaround I suggest you take a look at the original article on the Laravel Daily site.
Penjee released a in depth tutorial that explains the difference between passing by value and by reference.
When writing software code, you will spend a lot of time defining, reading and changing variables. Using a variable means you use a descriptive word in your code which holds some information (a number, some text, an object, etc.). This descriptive word is the “title” of the stored information