title: Undefined variable: header (View: C:\blog\resources\views\pages\welcome.blade.php)
body: <p>I am getting the below error when running application,</p>
  
  <pre><code>Undefined variable: header (View: C:\blog\resources\views\pages\welcome.blade.php)
  </code></pre>
  
  <p>My getIndex() function in Controller:</p>
  
  <pre><code>public function getIndex(){
          \View::make('pages/welcome')-&gt;nest('header', 'layout.header');
          return view('pages/welcome');
      }
  </code></pre>
  
  <p>My welcome.blade.php</p>
  
  <pre><code>{{ $header }}
  &lt;body&gt;
  ....
  &lt;/body&gt;
  </code></pre>
  
  <p>My _partial/header.blade.php,</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
      &lt;meta name="description" content=""&gt;
      &lt;meta name="author" content=""&gt;
      &lt;link rel="icon" href="../../favicon.ico"&gt;
  
      &lt;title&gt;Blog Template for Bootstrap&lt;/title&gt;
  
      &lt;!-- Bootstrap core CSS --&gt;
      &lt;link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"&gt;
  
      &lt;!-- Custom styles for this template --&gt;
      &lt;link href="{{ asset('css/style.css') }}" rel="stylesheet"&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>After following the answer, the html looks like,</p>
  
  <pre><code>&amp;lt;!DOCTYPE html&amp;gt;
  &amp;lt;html lang=&amp;quot;en&amp;quot;&amp;gt;
  &amp;lt;head&amp;gt;
      &amp;lt;meta charset=&amp;quot;utf-8&amp;quot;&amp;gt;
      &amp;lt;meta name=&amp;quot;viewport&amp;quot; content=&amp;quot;width=device-width, initial-scale=1, shrink-to-fit=no&amp;quot;&amp;gt;
      &amp;lt;meta name=&amp;quot;description&amp;quot; content=&amp;quot;&amp;quot;&amp;gt;
      &amp;lt;meta name=&amp;quot;author&amp;quot; content=&amp;quot;&amp;quot;&amp;gt;
      &amp;lt;link rel=&amp;quot;icon&amp;quot; href=&amp;quot;../../favicon.ico&amp;quot;&amp;gt;
  
      &amp;lt;title&amp;gt;Blog Template for Bootstrap&amp;lt;/title&amp;gt;
  
      &amp;lt;!-- Bootstrap core CSS --&amp;gt;
      &amp;lt;link href=&amp;quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot;&amp;gt;
  
      &amp;lt;!-- Custom styles for this template --&amp;gt;
      &amp;lt;link href=&amp;quot;http://127.0.0.1:8000/css/style.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot;&amp;gt;
  &amp;lt;/head&amp;gt;
  </code></pre>