Hey everyone I was creating a laravel project and I wanted to add the pagination but I faced this error :
Method Illuminate\Database\Query\Builder::links does not exist. (View: C:\xampp\htdocs\TestingTask\resources\views\income\index.blade.php)
Here is the controller code:
public function index()
{
$income =Income::orderBy('created_at','desc')->paginate(1);
return view('income.index', compact('income'));
}
The view code:
@extends('layouts.app')
@section('content')
<h3>Profit</h3>
<br>
@if(count($income)>0)
@foreach($income as $income)
<div class="card bg-muted">
<h3><a href="/income/{{$income->id}}">{{$income->title}}</a></h3>
</div>
@endforeach
{{$income->links()}}
@else
<p>No result</p>
@endif
@stop
foreach($income as $single_income)
– Ayaz Ali Shah