I am currently working on setting up a pagination feature using Laravel. When it comes to the backend, I have set up my JSON response in the following way:
if(isset($request->myDate)) {
$request->validate([
'myDate' => 'required|date',
]);
$start_date = $request->get('myDate');
$end_date = Carbon::now();
$my_tickets = Ticket::where('admin_id', Auth::user()->id)->whereBetween('updated_at', [$start_date, $end_date])->with(['getAdmin'])->paginate(10);
}
return json_encode($my_tickets);
As for the frontend part, I'm utilizing AJAX requests to show the rows. My main query now is how do I integrate the pagination system? Are there any built-in features in Laravel or external components that can simplify this task? Do I need to develop the front end myself since I cannot utilize the $var->links() function as when returning a view?
Warm Regards