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.

Published
Mar 26
Duration
8m 41s

Developer, dog lover, and burrito eater. Currently teaching AdonisJS, a fully featured NodeJS framework, and running Adocasts where I post new lessons weekly. Professionally, I work with JavaScript, .Net C#, and SQL Server.

Adocasts

Burlington, KY

Join The Discussion! (4 Comments)

Please sign in or sign up for free to join in on the dicussion.

  1. Commented 1 month ago

    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

    Please sign in or sign up for free to reply

    1. Commented 1 month ago

      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

      Please sign in or sign up for free to reply

      1. Commented 1 month ago

        Thanks a lot. It work now.

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

        1

        Please sign in or sign up for free to reply

        1. Commented 1 month ago

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

          Hope you enjoy your time with AdonisJS & Edge! 😊

          0

          Please sign in or sign up for free to reply