I have a page with a preview of the receipt, it's dynamic rendering with tenants info and signature.
When I click test, the form will submit, triggering an email to myself.
I've tried
public function email($id){
$code = Request::get('code');
$baby = Baby::where('adminCode',$code)->where('id',$id)
->orWhere('readOnlyCode',$code)->where('id',$id)
->first();
$input['name'] = 'John';
if($baby){
// $pdf = PDF::loadView('layouts.be.baby.email', get_defined_vars());
$pdf = PDF::loadView('layouts.share.emails.thanks', get_defined_vars());
$mail = Mail::to('layouts.share.emails.thanks', $baby, function($message)use($baby, $pdf) {
$message->to('bheng@gmail.com')
->subject('Rent Receipt For'. date('m Y'))
->attachData($pdf->output(), date('m Y').".pdf");
});
if($mail) {
return Redirect::to($_SERVER['HTTP_REFERER']) ->with('success','sent!');
}
}
}
See no error, also see no email.
How do I attach that receipt as an attachment in the email?