Php 拉雷维尔把弗雷奇放在邮件里

Php 拉雷维尔把弗雷奇放在邮件里,php,laravel,laravel-5,sendmail,swiftmailer,Php,Laravel,Laravel 5,Sendmail,Swiftmailer,我想在我的邮件功能中使用foreach,但我不确定如何做到这一点(我使用的是swiftmailer,但我认为这并不重要) 这是我的密码: Mail::send('emails.bestelling', array( 'mededeling' => $bestelcode, 'rekeningnummer' => '000/000000/00', 'naam' => $userNaam,

我想在我的邮件功能中使用foreach,但我不确定如何做到这一点(我使用的是swiftmailer,但我认为这并不重要)

这是我的密码:

Mail::send('emails.bestelling',
        array(
            'mededeling' =>  $bestelcode,
            'rekeningnummer' => '000/000000/00',
            'naam'  => $userNaam,
            'totaal' => $totaal,
            'producten' =>  
            foreach ($mand as $rij) 
            {
                $rij->name;
                $rij->qty;
            }


        }


        ), function($message)
    {
        $message->from('noreply@test.be');
        $message->to('test@test.com', 'Admin')->subject('Creative Displays Bestelling');
    });
使用foreach outside Mail()如下所示:

$production_string = '';
foreach ($mand as $rij) 
{
   $production_string .= "Name : ".$rij->name;
   $production_string .= ", Quantity : ".$rij->qty;
}

Mail::send('emails.bestelling',
        array(
            'mededeling' =>  $bestelcode,
            'rekeningnummer' => '000/000000/00',
            'naam'  => $userNaam,
            'totaal' => $totaal,
            'producten' =>  $production_string
        }
    ), function($message)
    {
        $message->from('noreply@test.be');
        $message->to('test@test.com', 'Admin')->subject('Creative Displays Bestelling');
    });

谢谢稍微增加一点是使$production_string='';在foreach之前,否则该变量不存在