Courses

React Laravel 12 Starter Kit: CRUD Project

Edit Form and Breadcrumbs

You're reading a FREE PREVIEW of a PREMIUM course.
Summary of this lesson:
- Adding "Edit" button to tasks table
- Building task editing form with checkbox for completion status
- Implementing form submission with proper error handling
- Adding breadcrumbs for improved navigation

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 14 lessons of this course? (77 min read)

You also get:

  • 76 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord