title: DOMPDF loadView() error - undefined variable: data
body: <p>I'm currently trying to incorporate the <a href="https://github.com/barryvdh/laravel-dompdf" rel="noreferrer">DOMPDF Wrapper for Laravel</a> into my project, however I'm having troble figuring out how to pass a variable into the PDF template.</p>
  
  <p>As per the instructions, in my controller I have:</p>
  
  <pre><code>//PrintController.php
  $data = array('name'=&gt;'John Smith', 'date'=&gt;'1/29/15');
  
  $pdf = PDF::loadView('contract', $data);
  return $pdf-&gt;stream('temp.pdf');
  </code></pre>
  
  <p>and in my view:</p>
  
  <pre><code>//contract.php
  ...
  &lt;p&gt;&lt;?php echo $data-&gt;name ?&gt;&lt;p&gt;
  &lt;p&gt;Signature&lt;/p&gt;
  </code></pre>
  
  <p>But when I try to render the page, I get the error:</p>
  
  <pre><code>ErrorException (E_UNKNOWN) 
  Undefined variable: data
  </code></pre>
  
  <p>I'm not sure why the <code>loadView()</code> method is not passing the <code>$data</code> variable to the view. Is there a step I'm missing in setting it up in the controller and/or view?</p>