0
PDF生成包barryvdh/laravel-dompdf
,PDF工作正常。我有這樣的代碼:打開PDF併發送電子郵件附件只需點擊一下
public function fun_pdf($test_id) {
$test = Test::where('id', $test_id)->first();
$questions = (new TestQuestionsController)->questionwithanswers($test_id, $randomorder = 1);
$test_info = (new TestInfoController)->testInfo($test_id);
$pdf = PDF::loadView('website.tests_pdf.take-test', ['test_id' => $test_id, 'questions' => $questions, 'test' => $test, 'test_info' => $test_info]);
$user_email = Auth::user()->email;
Mail::to($user_email)->send(new PdfTest($test));
return $pdf->stream('document.pdf');
}
我想發送PDF到電子郵件,也可以點擊按鈕打開。我也有一個電子郵件的代碼,在一個文件夾中Mail
我有這樣的代碼:
public $test;
public function __construct(Test $test) {
$this->test = $test;
}
/**
* Build the message.
*
* @return $this
*/
public function build() {
return $this->view('website.tests_pdf.take-test');
}
誰能請幫助我如何我做到這一點?
你嘗試過這麼遠嗎? –