title: How to conditionally include views in Blade with Laravel?
body: <p>I'm trying to include some views according to a variable set when defining the view to be rendered.</p>
  
  <p>This is when I render the view:</p>
  
  <pre><code>switch (Auth::user()-&gt;role) {
        case 'ADMINISTRADOR':
          return View::make('admin');
          break;
  
        case 'CAPTURISTA':
          return View::make('capturista');
          break;
  
        case 'GERENTE DE DEPARTAMENTO':
          return View::make('gerente');
          break;
  
        case 'SUPERVISOR DE COMPRAS':
          return View::make('supervisor', array('supervisor'=&gt;true));
          break;
  
        case 'GERENTE ADMINISTRATIVO':
          return View::make('administrativo');
          break;
      }
  </code></pre>
  
  <p>So I've tried a lot of things at view in order to load some views <strong>ONLY</strong> if supervisor is true (finally if it was set according to my code).</p>
  
  <h3>What I've tried</h3>
  
  <pre><code>@if(isset($supervisor))
    @include('includes.boss.supervisor.delivers_modal')
    @include('includes.boss.supervisor.prices_modal')
    @include('includes.boss.supervisor.providers_modal')
  @endif
  </code></pre>
  
  <hr>
  
  <pre><code>@if({{isset($supervisor)}})
    @include('includes.boss.supervisor.delivers_modal')
    @include('includes.boss.supervisor.prices_modal')
    @include('includes.boss.supervisor.providers_modal')
  @endif
  </code></pre>
  
  <hr>
  
  <pre><code>&lt;?php if(isset($message)) : ?&gt;
      @section('message')
          &lt;p&gt;hey all&lt;/p&gt;
      @endsection
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <hr>
  
  <p>Also I tried setting the <code>supervisor</code> variable for every view, naturally to false and true.</p>
  
  <pre><code>  @if($supervisor)
            @include('includes.boss.supervisor.delivers_modal')
            @include('includes.boss.supervisor.prices_modal')
            @include('includes.boss.supervisor.providers_modal')
    @endif
  </code></pre>
  
  <p>None of these worked, how should I achieve it?</p>
  
  <p><strong>* Just in case, I'm using sessions ...</strong></p>