From the course: Laravel Essential Training

Unlock the full course today

Join today to access over 25,000 courses taught by industry experts.

Add a show action and view to display single note

Add a show action and view to display single note - Laravel Tutorial

From the course: Laravel Essential Training

Add a show action and view to display single note

The next thing we implement is a view to display an entire individual note. First, let's turn this note title into a link by wrapping the title in anchor tags. So open index blade view. This is the title. So here, let's just wrap it with anchor tags a href. And here close the a tag. The URL here will be the show route, right? So that is route('notes.show'). And here we need to pass the second parameter. That is we need to pass which note we are trying to show. Now if you open the NoteController and if you go to the show method, this accepts the entire note as the parameter. So here you can pass this note itself as the second argument. All right. Let's save this, go to the browser, refresh, and let's add a class that, on hover, that shows an underline. So we can add a class hover:underline. And now let me refresh. And this is better. All right. Now let's click on the first note. All right. Notice we are redirected to the URL with the note ID. Notice that we didn't have to explicitly…

Contents