Laravel 8.x Custom Pagination Example Tutorial
Step 1: CreatePagination Template
As we are going to use laravel custom pagination template, that's why run below command to have it.
After running above command run you will get new folder "pagination" on views files(resources/views/vendor). In pagination folder you will get following files by default:
- default.blade.php
- bootstrap-4.blade.php
- simple-bootstrap-4.blade.php
- simple-default.blade.php
- semantic-ui.blade.php
But we are going to use our own custom pagination template. We don't use any of the above template.
Step 2: Add Route
Now we need routes to see our pagination page. So create this below route and create some dummy data of users.
routes/web.php
Step 3: Add Controller
Ok, now we have to add new controller method "index()" in your TestController, so if you haven't created TestController then you can create it and paste this following code.
app/Http/Controllers/TestController.php
Step 4: Create Blade File
Now we need to create our blade file for users view and custom pagination template. So create it with the following path.
resources/views/vendor/pagination/custom.blade.php
At last we have to create welcome.blade.php file and we will use our custom pagination template. So let's create welcome page and put bellow code on it.
resources/views/welcome.blade.php
0 comments: