Fix Invoice/Estimate template issues and Add Payment Receipt, Custom Payment Modes and Item units

This commit is contained in:
Jay Makwana
2020-01-05 07:22:36 +00:00
committed by Mohit Panjwani
parent 56a955befd
commit 4c33a5d88c
112 changed files with 5050 additions and 331 deletions

View File

@ -6,6 +6,7 @@ use Crater\Invoice;
use PDF;
use Crater\CompanySetting;
use Crater\Estimate;
use Crater\Payment;
use Crater\User;
use Crater\Company;
use Crater\InvoiceTemplate;
@ -376,4 +377,34 @@ class FrontendController extends Controller
return $pdf->stream();
}
public function getPaymentPdf($id)
{
$payment = Payment::with([
'user',
'invoice',
'paymentMethod'
])
->where('unique_hash', $id)
->first();
$company = Company::find($payment->company_id);
$companyAddress = User::with(['addresses', 'addresses.country'])->find(1);
$logo = $company->getMedia('logo')->first();
if($logo) {
$logo = $logo->getFullUrl();
}
view()->share([
'payment' => $payment,
'company_address' => $companyAddress,
'logo' => $logo ?? null
]);
$pdf = PDF::loadView('app.pdf.payment.payment');
return $pdf->stream();
}
}