title: Laravel Mail Undefined Variable
body: <p>I am trying to send email using Laravel Mail &amp; getting Undefined variable: data in view. Here is my controller code.</p>
  
  <pre><code>    $insured        =   Claim::where('id', '=', $claim_id)-&gt;first()-&gt;toArray();
      $workshop       =   Workshop::where('id', '=', $insured['workshop_id'])-&gt;first()-&gt;toArray();
      $data           =   Document::whereRaw('claim_id = ' . $claim_id . ' AND (documents.status = 10 OR documents.status = 12)')
                          -&gt;join('docs','documents.doc_id', '=', 'docs.id')
                          -&gt;join('claims','documents.claim_id', '=', 'claims.id')
                          -&gt;get(array('docs.email_text', 'claim_of', 'vehicle_no'))-&gt;toArray();
      Mail::send('emails.workshop', $data, function($message)
      {
          $message-&gt;to('someone@somedomain.com')-&gt;subject('Testing');
      });
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>{{ $data[0]['claim_of'] }}
  
  &lt;br /&gt;
  
  {{ $data[0]['vehicle_no'] }}
  
  &lt;br /&gt;
  
  
      &lt;?php $i = 1 ; ?&gt;
      @foreach($data as $key =&gt; $claim)
          &lt;p&gt; {{ $i }}. {{ $claim-&gt;email_text }}&lt;/p&gt;
          &lt;?php $i++ ; ?&gt;
      @endforeach
  </code></pre>
  
  <p>When I replace Laravel Mail code with</p>
  
  <pre><code>            return View::make('emails.workshop')-&gt;with('data', $data);
  </code></pre>
  
  <p>everything works perfectly.</p>