title: Pass data in an included view with Laravel 5.6
body: <p>Using Laravel 5.6, I'm trying to get the number of received links a logged-in user may have in my application.</p>
  
  <pre><code>public function getReceivedLinksCount() {
      return $count = App\Link::where([
                  ['recipient_id', Auth::id()],
                  ['sender_id', '!=', Auth::id()]
              ])-&gt;count();
  }
  </code></pre>
  
  <p>So far, so good. Question is not about that piece of code, but <em>where</em> I can use it. I'd like to display this counter on the navigation bar of the website (Facebook's style) which is in my <code>header.blade.php</code> which is included in every page.</p>
  
  <p>I'd like to do it with a clean code, of course. It seems like I need to use View Composers but I'm not sure it's the right way to do it, and not sure on how the code is supposed to look.</p>