Now, let's build the page to edit the task. It will be structurally similar to the Create form but with a few differences.
Also, at the end of this lesson, we will add breadcrumbs above the table.
Table: Link to Edit Route
We need to add the "Edit" button to the table.
<TableRow v-for="task in tasks" :key="task.id"> <TableCell>{{ task.name }}</TableCell> <TableCell :class="{ 'text-green-600': task.is_completed, 'text-red-700': !task.is_completed }"> {{ task.is_completed ? 'Completed' : 'In Progress' }} </TableCell> <TableCell class="text-right">// [tl! --] <TableCell class="flex gap-x-2 text-right">// [tl! ++] <Link :class="buttonVariants({ variant: 'default' })" :href="`/tasks/${task.id}/edit`">Edit </Link>// [tl! ++] <Button variant="destructive" @click="deleteTask(task.id)" class="mr-2">Delete </Button> </TableCell></TableRow>
Here's the visual result:
Edit Page: Vue Component
The previous code snippet above shows the URL /tasks/${task.id}/edit
. This corresponds to the
Controller method edit()
, which uses...