title: Laravel 5 get view name
body: <p>I'm struggling to get the view name in L5. Just as in WP, I'd like to add a specific page name (view name) for styling, like so:</p>
  
  <pre><code>&lt;!-- View name: login.blade.php !--&gt;
  &lt;div id="page" class="page-login"&gt;
      &lt;h1&gt;Inloggen&lt;/h1&gt;
  &lt;/div&gt;
  
  &lt;!-- View name: register.blade.php !--&gt;
  &lt;div id="page" class="page-register"&gt;
      &lt;h1&gt;Registreren&lt;/h1&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In L4 it can be done using composer to share the var across all views (<a href="https://stackoverflow.com/questions/22403655/how-can-i-get-the-current-view-name-inside-a-master-layour-in-laravel-4">How can I get the current view name inside a master layour in Laravel 4?</a>). But I only need the view name once for my master layout.</p>
  
  <p>Doing this:</p>
  
  <pre><code>&lt;div id="page" class="page-{{ view()-&gt;getName() }}"&gt;
  </code></pre>
  
  <p>Gives me the following error <code>Call to undefined method Illuminate\View\Factory::getName()</code>.</p>
  
  <p>Thanks in advance!</p>