title: how to pass a variable to service provider in Laravel?
body: <p>I want to generate a dynamic menu in a sidebar and share with all the views in Laravel 5.1.</p>
  
  <p>like:</p>
  
  <pre><code>- Marks Module
      - Langosh Topic
         - Content 1
         - Content 2
      -Nitzsche Topic
         - Content 3
  - Rolfson Module
  </code></pre>
  
  <p>Although All this elements belong another entity called <strong>course</strong> which I can select in the Top menu (users can have more than 1 course). </p>
  
  <p>So every time that I access, Course, Module, Topic or Content they need to tell the sidebar menu which course is the father (or grandfather) of all of those kids to generate the menu.</p>
  
  <p>in AppServiceProvider I have view composer and everything's working fine, but I am using sessions to get the course ID, and I don't like to idea.</p>
  
  <p>How can I pass the $course to the Service Provider or is there any other better way to do that?</p>