-
app/Http/Controllers/SupportTeam/PaymentController.php
Open in GitHubuse App\Models\Setting; use Illuminate\Database\Eloquent\ModelNotFoundException; use PDF; class PaymentController extends Controller { // public function pdf_receipts($pr_id) { if(!$pr_id) {return Qs::goWithDanger();} try { $d['pr'] = $pr = $this->pay->getRecord(['id' => $pr_id])->with('receipt')->first(); } catch (ModelNotFoundException $ex) { return back()->with('flash_danger', __('msg.rnf')); } $d['receipts'] = $pr->receipt; $d['payment'] = $pr->payment; $d['sr'] = $sr =$this->student->findByUserId($pr->student_id)->first(); $d['s'] = Setting::all()->flatMap(function($s){ return [$s->type => $s->description]; }); $pdf_name = 'Receipt_'.$pr->ref_no; return PDF::loadView('pages.support_team.payments.receipt', $d)->download($pdf_name); //return $this->downloadReceipt('pages.support_team.payments.receipt', $d, $pdf_name); } // }