title: Conditional extends in Blade
body: <p>Is there any way to do a conditional <code>@extends</code> statement in the Blade templating language?</p>
  
  <h2>What I've tried:</h2>
  
  <pre><code>@if(!Request::ajax())
      @extends('dashboard.master')
      @section('content')
  @endif
  
  &lt;div class="jumbotron"&gt;
      Hey!
  &lt;/div&gt;
  
  @if(!Request::ajax())
      @stop
  @endif
  </code></pre>
  
  <h2>Output</h2>
  
  <p>When the request was not AJAX it printed out <code>@extends('dashboard.master')</code>, but the AJAX request worked fine.</p>
  
  <h2>What I'm trying to do</h2>
  
  <p>Stop including the master template (which includes <code>header</code> and <code>footer</code>) for AJAX so it can easily display the requested content</p>