0
我有一個數據庫充滿了用戶,在後端我有一個按鈕來收集我的數據庫並將其下載爲一個Excel文件。 (使用Maatwebsite)。同時,我希望管理員能夠收到帶有此Excel文件的電子郵件。我如何將這個欄目添加到電子郵件中? 這是代碼:下載和郵件Excel文件Laravel
public function excel()
{
Excel::create('Participants', function($excel) {
$excel->sheet('Participants', function($sheet) {
$sheet->fromArray(Participant::where('enabled',1)->get(), null, 'A1', false, false);
});
})->download("xlsx");
Mail::raw("In attachment excelfile of participants ", function($message)
{
$message->subject('ExcelFile Participants!');
$message->from('[email protected]', 'As Adventure Contest');
$message->to('[email protected]');
//$message->attachData(, 'Participants.xlsx');
});
}