Link to the repository
[Only for premium members]
[Only for premium members]
In this lesson, we will add pagination to our table. It won't be an easy one-minute process.
app/Http/Controllers/TaskController.php
// ... public function index(){ return Inertia::render('Tasks/Index', [ 'tasks' => Task::all() 'tasks' => Task::paginate(5) ]);} // ...
Now, our Task List page will stop working because of a TypeScript structure mismatch. We return
paginate()
from Controller, which is no longer the array of the Task
type. Let's fix
this.
We return tasks
from the Controller not as a list but as a paginated object.
So, we need to create a specific new type for it, corresponding to the structure returned by...