title: Laravel - Send Variable to layout master and keep it during session
body: <p>I am wondering if there are any way in laravel to send a variable to the layout master and keep it there while the user is logged in. I know how I can do it, like this </p>
  
  <pre><code>$this-&gt;layout-&gt;with('catalog.categories', $data);
  </code></pre>
  
  <p>But the problem of this is that I will have to be sending the variable on all the controllers and through all the class. And to get the variable I will need seven or eight lines of code on top of that.</p>
  
  <p>I will give you an easy example. Imagine I have a messenger center in my web. And I want to show the user all the messages he did not read on the top bar. It has to be on the layout master and stay there until he read the messages. Do I have to pass this variable every single time the user changes the route?</p>