2017-10-14 22 views
0

나는 데이터베이스를 수집하고 엑셀 파일로 다운로드 할 수있는 백엔드에 사용자가 가득한 데이터베이스를 가지고있다. (Maatwebsite 사용). 동시에 관리자가이 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'); 
    }); 
} 

답변

1

나는 당신이 당신의 Excel 파일을 저장하고 메일 cf. Laravel Documentation에 첨부한다고 생각합니다. Excel을 저장하려면 '저장소'기능을 사용할 수 있습니다 : Laravel Excel Store.

그런 다음 삭제하거나 그대로 둘 수 있습니다.