Fixes for download invoices from client portal

This commit is contained in:
David Bomba 2021-07-09 08:01:37 +10:00
parent 108512068e
commit 87d0020152

View File

@ -24,6 +24,7 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\View\View; use Illuminate\View\View;
use ZipStream\Option\Archive; use ZipStream\Option\Archive;
use ZipStream\ZipStream; use ZipStream\ZipStream;
use Illuminate\Support\Facades\Storage;
class InvoiceController extends Controller class InvoiceController extends Controller
{ {
@ -170,8 +171,10 @@ class InvoiceController extends Controller
$invitation = $invoice->invitations->first(); $invitation = $invoice->invitations->first();
//$file = $invoice->pdf_file_path($invitation); //$file = $invoice->pdf_file_path($invitation);
$file = $invoice->service()->getInvoicePdf(auth()->user()); $file = $invoice->service()->getInvoicePdf(auth()->user());
return response()->download($file, basename($file), ['Cache-Control:' => 'no-cache'])->deleteFileAfterSend(true);; // return response()->download($file, basename($file), ['Cache-Control:' => 'no-cache'])->deleteFileAfterSend(true);;
return response()->streamDownload(function () use($file) {
echo Storage::get($file);
}, basename($file));
} }
// enable output of HTTP headers // enable output of HTTP headers