Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Edit Form and Breadcrumbs

Premium
6 min read

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.

{tasks.map((task) => (
<TableRow key={task.id}>
 
// ...
 
<TableCell className="flex flex-row gap-x-2 text-right">
 
<Link className={buttonVariants({ variant: 'default' })}
href={`/tasks/${task.id}/edit`}>
Edit
</Link>
 
<Button variant={'destructive'} className={'cursor-pointer'}
onClick={() => deleteTask(task.id)}>
Delete
</Button>
</TableCell>
</TableRow>
))}

Here's the visual result:


Edit Page: React Component

The previous code snippet above shows the URL /tasks/${task.id}/edit. This corresponds to the Controller method edit(), which uses Route Model Binding to find the task.

app/Http/Controllers/TaskController.php

public function edit(Task $task)
{
return Inertia::render('Tasks/Edit', [
'task' => $task,
]);
}

Now, we need to create the..

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

SP
Steve Popoola ✓ Link copied!

Hi,

Just a small typo in the tutorial. In the breadcrumbs section for create:

const breadcrumbs: BreadcrumbItem[] = [
    { title: 'Dashboard', href: '/dashboard' },
    { title: 'Tasks', href: '/tasks' },
    { title: 'Create', href: '/tasks' },
];

The href for 'Create' should be to an empty string { title: 'Create', href: ' ' },