The question is not directly on how to show the pagination that much I'm aware but rather how to modify it so that I can show it here
public function create()
{
$leaves = Leave::latest()->where('user_id',auth()->user()->id)->get();
$pagination = Leave::latest()->paginate(5);
return view('leave.create',compact('leaves'),compact('pagination'));
}
The create function here returns to a page where you can create and view all that you have created at the same time on a table but the table keeps getting bigger so I wanted to add pagination here but it seems this is not the correct way I tried adding the ->paginate(5) right after latest() of $leaves but it showed an error
Is there another way I can add the pagination, the one right now works but it shows the leaves of all users but I need it to only show of that specific user that's why I added the auth up but I think the one under for pagination is overriding it
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire