Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open() argument #1 ($filename) must not contain any null bytes #1030

Open
MyNameIsDVL opened this issue Jan 29, 2024 · 1 comment
Open

open() argument #1 ($filename) must not contain any null bytes #1030

MyNameIsDVL opened this issue Jan 29, 2024 · 1 comment

Comments

@MyNameIsDVL
Copy link

This is my Service

use Barryvdh\DomPDF\Facade\Pdf;

class PdfService
{
    public function __construct()
    {}

    public static function voucher(Voucher $voucher)
    {
        $data = [
            'total_amount' => $voucher->amount,
            'code' => $voucher->code
        ];

        return Pdf::loadView('pdf.voucher', $data)->stream('voucher_'.$voucher->code.'.pdf');
    }
}

My markdown mail:

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        $attachments = array();
        foreach ($this->vouchers as $voucher) {
            array_push($attachments, PdfService::voucher($voucher));
        }
        return $this->markdown('mail.voucher', ['vouchers'=>$this->vouchers])->subject('Oto Twój voucher')->attachMany($attachments);
    }

What am I doing wrong? Thanks

@parallels999
Copy link

parallels999 commented Jan 29, 2024

Seems like argument #1 ($filename) contains null bytes 😄😄

Also you are adding Response class to attachMany, you must attach only the output

->attachData($pdf->output(), 'voucher_'.$voucher->code.'.pdf')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants