user = $user; $this->invoices = $invoices; } /** * Execute the job. * * @param ContactMailer $mailer */ public function handle(UserMailer $userMailer) { if (! extension_loaded('GMP')) { die(trans('texts.gmp_required')); } $zip = Archive::instance_by_useragent(date('Y-m-d') . '_' . str_replace(' ', '_', trans('texts.invoice_pdfs'))); foreach ($this->invoices as $invoice) { $zip->add_file($invoice->getFileName(), $invoice->getPDFString()); } $zip->finish(); exit; } }