jeudi 28 décembre 2017

how filter data to print PDF file from comments table in Laravel?

I need print comments witch related to each task from My task table in My laravel application,

This is pdf out put controller,

class TcommentPDFController extends Controller
{
    public function getTCPDF(){
        $comments = Comment::where('task_id')->get();
        $pdf = PDF::loadView('pdf.taskcomments',['comments'=>$comments]);
        return $pdf->stream('taskcomments.pdf');
    }

and route is this,

<li><a href="/project//tasks//getTCPDF">Comments Report</a></li>

and My comments table structure is like this,

id   comments  project_id  task_id
 1     frt         1          2
 2     ghy         1          4
 3     hgy         2          6
 4     lkj         5          9

my blade file is this

<tr>
<td>
                             </td><td></td><td></td>
                             <td></td>

                            </tr>

how can do this?



via Chebli Mohamed

1 commentaire:

  1. follow this tutorial it will help you
    https://www.webslesson.info/2018/06/laravel-how-to-generate-dynamic-pdf-from-html-using-dompdf.html

    RépondreSupprimer