Laravel 10 - How to make pagination in Laravel 10 with Bootstrap & Tailwind step by step

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome back so guys in this video we are going to learn how to make a pagination in larel 10 okay so guys let me just show you my customers records so here is my customer record guys and I want to page Nate this after five five record okay so first page Nation will show five record and the next page Nation will show other five records okay so now guys First Step let's move to this route and create the page Nation view so let's go back to our editor and move to your routes web.php and here is a customer route guys and which goes to the customer controller at index function so let's move there add the customer controller at index function in this we are rning the customer record by using all so now instead of getting all the customer record directly we'll be using pag Nation so guys instead of all or you might be used get or with some conditions okay so at the last you just need to add paging Nate function and in that you have to pass your number for example I want to show like four four records okay now go back to your blade file so let's move there and where is our table so guys this is my table what I have looped and shown the customer record here okay so this is the record which is looping through this tables so guys after your table ends just create a simple tag open and close div and here you need to get that complete variable and use Link so get back to your controller and you have passed your variable right this customer variable to access in your blade file so let's copy that customers variable open and close clyra and insert this dollar customers of lkss links okay so this will give you a complete pagination now let me just show you the output once so refresh okay so you see here guys showing some results about the pagination and if you scroll down so here you see that Navigation icon and here is a one to pagination and then next pagination so guys the UI is messy why because I'm using a bootstrap so you have to mention that I'm using a bootstrap so according that please design the UI so guys there are many ways to do that so one of the way is like directly here pag Nation colon bootstrap hyphen 4 or five so according to your requirement you can update that so right now I'm using the bootstrap 5 let me just confirm that so go to my extend layouts go to layouts and app web layouts so you see here I'm using bootst 5 okay which I have extended the layout here yep so now you can get back refresh oops I think I have given a mistake here like it should be colon col like pagination colon colon bootst 5 now get back refresh perfect so it got refreshed guys here you see that design has changed here and pagination also is working fine okay so here you see that pagination two it's coming from 5 to 8 the pagination one goes with the 1 to 4 done so now guys what in case if you use bootstrap 4 so what happens here refresh and it comes like this okay so this is bootstrap for pagination UI and now guys here we are using this pagination of bootstrap five or four so guys if you don't want to use this here again and again in all over the application so we can set up globally through the app service provider okay so guys for that you just need to go to your app providers where app service provider and here is your boot function so inside this boot function you have to mention your paginator okay so paginator colon colon use bootstrap function and you need to import this class let me import here eluminate pagination paginator okay so let's click that let me just show you so this is the import class guys and now let's get back to our blade file so here only links you have to provide and you have set up the pageor which is going to be bootstrap so now if you refresh here you see that by default it's coming bootstrap 4 UI itself so guys this is providing the bootstrap 4 and again if you want to tell here like bootstrap 4 just add this function name like use bootstrap 4 it is going going to give the same result okay so here you see same result so now if I want to use bootst 5 just copy and paste and change to fiv5 and now get back to your browser refresh perfect so here you see the UI changes and you don't have to repeat this again and again like here you don't need to mention that okay so guys this was all about bootstrap setup so what in case of Tailwind CSS so guys if you're not using bootstrap that means you will be using Tailwind CSS so at that time you can just remove all the pagination from the boot function about the bootst and just live as it is here okay so by default twiin CSS is applied to the laral pagination so guys let me just show you how you can see the UI of twiin CSS so right now I'm extending this layout right here like app web layout which is this and here I have linked the bootstrap so let me just comment my CSS and GS CDN link of the bootstrap and let me activate the Tailwind CSS okay and now you can get back and refresh here so you see the UI has changed because the bootst UI I have used so it's messy now but you can see that pagination is working perfect here okay you see this this corner with the Tailwind CSS so you don't need to mention anything now we can get back and uncomment and set up the bootstrap classes let me use the bootstrap 5 and here we have set up already okay so guys in this video we have learned about how to set up the page Nation or use the pag nation in larell application so guys in this video that's it thank you for watching this video Please Subscribe like and share
Info
Channel: Funda Of Web IT
Views: 1,350
Rating: undefined out of 5
Keywords: fundaofwebit, how to make pagination in laravel 10, pagination tutorial in laravel 10, how to use paginate in laravel, laravel pagination tutorial step by step, create pagination in laravel, pagination laravel 10, laravel 10 pagination, how to add pagination in laravel, make pagination using laravel, How to Perform Laravel Custom Pagination, How to use pagination in laravel, laravel 10 tutorial 2024
Id: QDHUcJVykHM
Channel Id: undefined
Length: 7min 2sec (422 seconds)
Published: Thu Jan 25 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.