Laravel 11 Tutorial

Published: 28 September 2024
on channel: Stack Developers
54
1

►Laravel 11 Tutorial (with MongoDB):    • Laravel 11 Tutorial (with MongoDB)  

This is Part 123 of the Laravel 11 Tutorial, in which we are building the e-commerce website with Laravel as the front end and MongoDB as the back end.

In this part, we will work on generating the COD order invoice in PDF format.

We will install the Laravel-Dompdf package to generate PDF.

Take the below steps to add the Laravel-Dompdf package and generate a PDF invoice:-

1) Install laravel-dompdf package :-
First of all, install laravel-dompdf package through below composer command :-
composer require dompdf/dompdf

We will follow below Github link to install the Laravel dompdf package:-
https://github.com/dompdf/dompdf

2) Update orders.blade.php file :-
Add font awesome link icon for "Print PDF Invoice" in orders.blade.php file for shipped and delivered orders by adding a condition.

3) Create Route:-
Now create a GET route for view/print pdf invoice in the web.php file like below:-

// Print PDF Invoice
Route::get('print-pdf-invoice/{id}',[OrderController::class,'printPDFInvoice']);

4) Create printPDFInvoice function :-
Now create the printPDFInvoice function same as the viewOrderDetails function in OrderController in which we will get order details that we are going to add to the pdf invoice.

5) Add Header Statement :-
Don't forget to include Dompdf class at the top of ProductsController

6) Search PDF Invoice HTML format :-
Search in Google like "pdf invoice html format" and open below website :-
https://htmlpdfapi.com/blog/free_html...

Copy the Invoice HTML and update in output variable in printPDFInvoice function.

You can generate now static PDF Invoice that we can print with Ctrl+P command or simply click on Print button at top right of PDF.

In the next video, we are going to make PDF invoice dynamic.

►Click here to subscribe for Laravel & other updates -    / stackdevelopers  

Popular Stack Developers Series that can help you:-

►Laravel 11 PostgreSQL Tutorial:    • Laravel PostgreSQL Tutorial  

►Laravel 10 Tutorial:    • Laravel 10 Tutorial: Make Admin Panel...  

►Laravel Multi-Vendor E-commerce Series -    • Laravel Multi Vendor Tutorial  

►React JS Tutorial for Beginners with Laravel -    • React JS Tutorial with Laravel for Be...  

►Laravel Tutorial for Beginners -    • Laravel Tutorial for Beginners | Adva...  

►GIT Tutorial for Beginners -    • Git Tutorial for Beginners | Create y...  

►Laravel API Tutorial -    • Laravel API Tutorial | Create API fro...  

►Laravel Interview Questions -    • Laravel Interview Questions & Answers...  

►jQuery Tutorial -    • jQuery Tutorial  

►Laravel Basic E-commerce Series -    • Make Admin Panel / E-commerce Website...  

►Laravel Dating Series -    • Make Dating / Social Networking Websi...  

►Join this channel to get the complete source code of all series:
   / @stackdevelopers  

Follow Stack Developers on Social Media to get updates and resolve your queries
►Like Facebook Page to get updates -   / stackdevelopers2  
►Join Facebook Group to resolve your queries -   / stackdevelopers  
►Follow on Instagram -   / stackdevelopers2  
►Follow on GitHub - https://github.com/stackdevelopers

#laravel11 #mongodb #mongodbtutorial


Watch video Laravel 11 Tutorial online without registration, duration hours minute second in high quality. This video was added by user Stack Developers 28 September 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 54 once and liked it 1 people.