Playing Next Lesson In
seconds

Let's Learn AdonisJS 6 #5.6

Listing A Director's Movies with Relationship Existence Queries

In This Lesson

We'll learn how we can perform a relationship existence check to grab a list of our cineasts who have directed one or more movies. We'll then create a show page for that director, listing the movies that they directed.

Created by
@tomgobich
Published

Join the Discussion 4 comments

Create a free account to join in on the discussion
  1. @nico75

    Hey, first, thanks for this full tutorial.

    I try to use route with a custom button component

    Copied!

    @shared.button({href: "{{route('movie.show', {id: movie.slug})}}", class: ""}) View Details @end

    this not work

    @shared.button({href: "movies/" + movie.slug, class: ""}) View Details

    this work

    Is there a way to achieve this ?

    1
    1. Responding to nico75
      @tomgobich

      Hey Nico! Thanks for watching!

      When you're passing props into your button component, you're already inside of an EdgeJS interpolation area. So, at that point you don't need the double-curly braces and adding them will actually mess things up in that context. Instead, you can directly access the route function, like below.

      @shared.button({ href: route('movie.show', { id: movie.slug }), class: "" })
        View Details
      @end
      Copied!

      Also, and this might've just been formatting in the comment, but just in case also be sure the start and end tags for your EdgeJS components are on their own lines.

      1
      1. Responding to tomgobich
        @nico75

        Thanks a lot. It work now.

        I'm going to continue to watch the videos, very helpfull to learn Adonis and Edge !

        1
        1. Responding to nico75
          @tomgobich

          You're welcome, Nico! Happy to hear all is working now!

          Hope you enjoy your time with AdonisJS & Edge! 😊

          1