Portal payment added print and pdf action..

This commit is contained in:
Cüneyt Şentürk
2021-06-27 12:59:56 +03:00
parent 116562ea03
commit 339e7b320a
10 changed files with 92 additions and 152 deletions

View File

@ -7,10 +7,13 @@ use App\Models\Banking\Transaction;
use App\Models\Setting\Currency;
use App\Http\Requests\Portal\PaymentShow as Request;
use App\Utilities\Modules;
use App\Traits\Transactions;
use Illuminate\Support\Facades\URL;
class Payments extends Controller
{
use Transactions;
/**
* Display a listing of the resource.
*
@ -53,6 +56,50 @@ class Payments extends Controller
return $this->response('portal.currencies.index', compact('currencies'));
}
/**
* Show the form for viewing the specified resource.
*
* @param Transaction $payment
*
* @return Response
*/
public function printPayment(Transaction $payment, Request $request)
{
event(new \App\Events\Transaction\TransactionPrinting($payment));
$revenue = $payment;
$view = view($payment->template_path, compact('revenue'));
return mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
}
/**
* Show the form for viewing the specified resource.
*
* @param Transaction $payment
*
* @return Response
*/
public function pdfPayment(Transaction $payment, Request $request)
{
event(new \App\Events\Transaction\TransactionPrinting($payment));
$currency_style = true;
$revenue = $payment;
$view = view($payment->template_path, compact('revenue', 'currency_style'))->render();
$html = mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
$pdf = app('dompdf.wrapper');
$pdf->loadHTML($html);
//$pdf->setPaper('A4', 'portrait');
$file_name = $this->getTransactionFileName($payment);
return $pdf->download($file_name);
}
public function signed(Transaction $payment)
{
if (empty($payment)) {