Skip to content

Commit

Permalink
Merge pull request #4697 from devansh-webkul/s-2
Browse files Browse the repository at this point in the history
Invoice Issue Fixed - SA2
  • Loading branch information
ghermans committed Mar 1, 2021
2 parents e58d64e + 373296c commit 2a24098
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Webkul\Shop\Http\Controllers;

use PDF;
use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Sales\Repositories\InvoiceRepository;
use PDF;

class OrderController extends Controller
{
Expand Down Expand Up @@ -83,6 +83,10 @@ public function print($id)
{
$invoice = $this->invoiceRepository->findOrFail($id);

if ($invoice->order->customer_id !== auth()->guard('customer')->user()->id) {
abort(404);
}

$pdf = PDF::loadView('shop::customers.account.orders.pdf', compact('invoice'))->setPaper('a4');

return $pdf->download('invoice-' . $invoice->created_at->format('d-m-Y') . '.pdf');
Expand Down

0 comments on commit 2a24098

Please sign in to comment.