Why you shouldn’t set global variables in Base Controller

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.