From the course: Laravel Essential Training
Unlock the full course today
Join today to access over 25,000 courses taught by industry experts.
Add an edit method and view to allow editing of the note - Laravel Tutorial
From the course: Laravel Essential Training
Add an edit method and view to allow editing of the note
We are now able to view all the latest notes of the user, create a new note, and view individual notes. Now it's time to add an edit button here and allow the user to make changes to the note. Open the show blade view. On the top here, after the timestamps, let's add a link to edit the note. Let's reuse the link button component that we created. x-link-button. This would be Edit Note. Let's add a class, ml-auto, to push this to the right, since we are using flex. The href for this will be notes.edit. So route notes.edit where the second argument once again will be the note itself, since we're using route model binding. Now let's see what this gives us. Refresh. Great. We have the edit note button. Click on that and you'll notice the change in the URL. It's this note ID/edit. Let's add the required functionality in the edit method of the controller. Open NoteController. Scroll down to the edit method. Here, we only need to return the edit view, but after verifying if the user is…
Contents
-
-
-
-
-
-
-
(Locked)
Add an edit method and view to allow editing of the note4m 30s
-
(Locked)
Add an update method to update edited data2m 25s
-
(Locked)
Add a destroy method to delete a note3m 17s
-
(Locked)
Show flash data to users4m 50s
-
(Locked)
Challenge: Update notes with a new resource1m 14s
-
(Locked)
Solution: Update notes with a new resource7m 44s
-
(Locked)
-
-
-