Laravel 7 Database: Pagination

Siddharth Shukla
1 min readMar 7, 2020

--

Laravel Pagination

Add in Controller

In this example the we need to pass only digit how many records need to find on same page. In this case, let's specify that we would like to display 5 items per page:

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;

class BlogController extends Controller
{
public function index()
{
$blog = DB::table('blog')->paginate(5);

return view('blog', ['data' => $blog]);
}
}

Read More: https://realprogrammer.in/laravel-7-database-pagination/

--

--

Siddharth Shukla
Siddharth Shukla

Written by Siddharth Shukla

I'm a Full Stack Engineer based in India ☀️, working at Kreativ Street. I'm a coding passion focused on Python, specifically Laravel & Django.

No responses yet