Did you see the loadView in the documentation.
Nov 9, 2021
3
Level 1
How can i generate a pdf of a certain ticket?
Im trying to generate a pdf to download or print of a certain ticket by passing an id.
So i did the following:
public function TicketPdf($id){
$date = Ticket::find($id);
}
To identify the ticket i want to generate the pdf of.
This is my pdf view i want to generate for the specific ticket:
@extends('backend.layouts.master')
@section('content')
</div><!-- /.col -->
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
<li class="breadcrumb-item">Ventas</li>
<li class="breadcrumb-item">Pagos Recibidos</li>
</ol>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<!-- Main row -->
<div class="row">
<!-- Left col -->
<section class="col-md-12">
<!-- Custom tabs (Charts with tabs)-->
<div class="card" style="background-image: linear-gradient(200deg, #070525ce 1%, rgb(1, 0, 5)100%);">
<div class="card-header">
<h3 class="font-weight-light text-white">Pagos Recibidos
<a class="btn bg-white float-right btn-sm" href="" target="_blank"><i class="fa fa-download"></i> DownloadPDF</a>
</h3>
</div>
</div><!-- /.card-header -->
<div class="card-body">
<table id="example1" class="table table-bordered table-hover">
<thead class="thead">
<tr>
<th>Cliente</th>
<th>Numero Factura</th>
<th>Fecha</th>
<th>Monto</th>
<th>Ver</th>
</tr>
</thead>
<tbody>
@php
$total_paid = '0';
@endphp
@foreach($allData as $key => $payment)
<tr>
<td>
{{$payment['customer']['name']}}
{{$payment['customer']['mobile_no']}}-{{ $payment['customer']['address'] }}
</td>
<td>{{$payment['invoice']['invoice_no'] }}</td>
<td>{{date('d-m-Y', strtotime($payment['invoice']['date']))}}</td>
<td>{{$payment->paid_amount}}</td>
<td>
<a title="details" class="btn btn-sm btn-success" href="{{ route('customers.paid.pdf',$payment->invoice_id) }}" target="_blank">
<i class="fa fa-eye"></i></a>
</td>
@php
$total_paid += $payment->paid_amount;
@endphp
</tr>
@endforeach
</tbody>
</table>
<table class="table table-bordered table-hover">
<tbody>
<tr>
<td colspan="5" style="text-align: right; font-weight:bold;">Total</td>
<td><strong>{{ $total_paid }}</strong></td>
</tr>
</tbody>
</table>
</div><!-- /.card-body -->
</div>
<!-- /.card -->
</section>
<!-- right col -->
</div>
<!-- /.row (main row) -->
</div><!-- /.container-fluid -->
</section>
<!-- /.content -->
@endsection
How can i do so that when i click on a generate pdf button and passing to it the route to generate this pdf. So i dont know in my method how to make the logic to dompdf and how to generate it
Please or to participate in this conversation.