2014-10-31 60 views
0

我的控制器生成此數據數組:

Array 
(
    [bothweek] => Array 
     (
      [0] => 2014-10-26 
      [1] => 2014-10-19 
     ) 

    [projects] => Array 
     (
      [0] => stdClass Object 
       (
        [day_name] => Wednesday 
        [project_date] => 2014-10-22 
        [invoiced_date] => 2014-10-31 
        [week_end_day] => 2014-10-26 
        [user_name] => John 
       ) 
     ) 
) 

但是,當我嘗試發送這郵件刀片,它不承認這個數組,可以有人請給我一個解決方案,謝謝你,

Mail::send('project.mail', $data, function ($message) { 
    $message->from('email', 'ABC'); 

    $message->to('send'); 

}); 

回答

1

如果你想$data是在您訪問查看文件project.mail你需要使用['data' => $data]作爲第二個參數,否則你將得到兩個變量,$bothweek$projects

Mail::send('project.mail', ['data' => $data], function ($message) { 
    ... 
});