esaeng's avatar

Method Illuminate\Database\Eloquent\Collection::links does not exist. (View: C:\Users\Q c\laravel\Pagination_Laravel\resources\views\home.blade.php)

Hi there..I am doing pagination in Laravel. and getting this error..suggestions plzz.... here error is coming. ``

{!! $employeeData->links() !!} ``
0 likes
7 replies
tisuchi's avatar

@esaeng

Can you show your controller code?

Before try this-

{{ $employeeData->links() }} 
Sinnbeck's avatar

Show your controller code. And it is 3 back ticks, not 2

esaeng's avatar

here is my controller code.


<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;

use App\Models\Employee;

class EmployeeController extends Controller
{
    public function getData(){
      $employees = Employee::all();

      // dd($employeeData[0]->firstname);

      // return view('home', compact('employeeData'));
            return view('home',compact('employees'));

    }
}
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

You need to use paginate

$employees = Employee::paginate();
1 like

Please or to participate in this conversation.