Reputation: 123
I used correct code but i don't know why links are not showing on view. i tried many solutions also but didn't work any.Can anyone help me to get out of this trouble?
Controller
public function show_all(){
$all_records=DB::table('registrations')->paginate(3);
return view('Admin.view_doctor',['all'=>$all_records]);
}
View
<div class="style">
{{ $all->links() }}
</div>
Upvotes: 2
Views: 6619
Reputation: 7561
I think this deserves a proper answer:
Laravel pagination HTML only shows when your data is greater than 1 page.
So for testing purposes, you could reduce your perPage
number to a very low number, so multiple pages can be shown in the paginator:
User::where('status', 1)->paginate(1);
Function definition:
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
Upvotes: 5