invoice = $invoice; } public function handle() { $this->invoice->load('client'); $path = 'public/' . $this->invoice->client->client_hash . '/invoices/'; $file_path = $path . $this->invoice->number . '.pdf'; //get invoice design $html = $this->generateInvoiceHtml($this->invoice->design(), $this->invoice); //todo - move this to the client creation stage so we don't keep hitting this unnecessarily Storage::makeDirectory($path, 0755); //create pdf $pdf = $this->makePdf(null,null,$html); $path = Storage::put($file_path, $pdf); } /** * Returns a PDF stream * * @param string $header Header to be included in PDF * @param string $footer Footer to be included in PDF * @param string $html The HTML object to be converted into PDF * * @return string The PDF string */ private function makePdf($header, $footer, $html) { return Browsershot::html($html) //->showBrowserHeaderAndFooter() //->headerHtml($header) //->footerHtml($footer) ->waitUntilNetworkIdle(false)->pdf(); //->margins(10,10,10,10) //->savePdf('test.pdf'); } }