CodeIgniter Laravel PHP Example HTML Javascript jQuery MORE Videos New

Laravel pagination example

There are various ways to paginate in laravel. The eaisest way is paginate item in laravel is paginate method on the query builder or an Eloquent query.

It's automatically add the paginate to item, table etc.

In this example we pass argument 10 to show 10 item per page.


namespace App\Http\Controllers;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
class UserController extends Controller
     * Show all of the users for the application.
     * @return Response
    public function index()
        $users = DB::table('users_data')->paginate(10);
		return view('user.index', ['users_data' => $users]);