Level 75
Change
{{ $imcs->links() }}
to
{{ $imc_obj->links() }}
1 like
I'm trying to paginate my view, but i get this error -
Call to undefined method Illuminate\Database\Query\Builder::links()
Controller function -
public function index()
{
$imc_obj = Imc::where('user_id', Auth::id())->paginate(5);
return view('imc.index', compact('imc_obj'));
}
View file -
@foreach ($imc_obj as $imcs)
<tr>
<td>{{ $imcs->name }}</td>
<td>{{ date('F d, Y', strtotime($imcs->created_at)) }}</td>
</tr>
@endforeach
</tbody>
</table>
{{ $imcs->links() }}
Change
{{ $imcs->links() }}
to
{{ $imc_obj->links() }}
Please or to participate in this conversation.