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() !!}
``
@esaeng
Can you show your controller code?
Before try this-
{{ $employeeData->links() }}
Show your controller code. And it is 3 back ticks, not 2
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'));
}
}
You need to use paginate
$employees = Employee::paginate();
@esaeng Plz mark @sinnbeck answer's as the best reply and make this question as solved. :)
Please or to participate in this conversation.