Undefined variable in foreach loop
<p>When I do a <code>foreach()</code> loop, the current array element's value <code>$recipient</code> is not defined on the line <code>-&gt;to($recipient)</code>. Why is this?</p>

<p><strong>PHP Code (throws error)</strong></p>

<pre><code>foreach($recipients as $recipient) {
    Mail::send('emails.invite', $data, function($m){
        $m
            -&gt;from('welcome@website.com', Auth::user()-&gt;name)
            -&gt;to($recipient)
            -&gt;subject('Auth::user()-&gt;name has invited you!');
    });
}
</code></pre>

<p><strong>Error</strong></p>

<pre><code>Notice: Undefined variable: recipient
</code></pre>

<p><strong>PHP Code (NO error)</strong></p>

<pre><code>foreach($recipients as $recipient) {
    echo $recipient;
}
</code></pre>
