Let's Learn AdonisJS 5: Ep 5.6 - Defining Model Relationships

Опубликовано: 02 Апрель 2026
на канале: Adocasts
2,119
45

In this lesson, we'll learn how to define relationships on our Lucid Models. We'll cover one-to-one, many-to-one, one-to-many, and many-to-many relationship definitions and discuss some of the mapping options AdonisJS provides, including pivot table columns.

👍 If You Enjoy This Video, Consider Hitting The Like Button!

🥁 Subscribe: https://www.youtube.com/adocasts?sub_...

📕 View on Adocasts: https://adocasts.com/lessons/defining...

👨‍💻 Browse the Code: https://github.com/adocasts/lets-lear...

🎬 Check Out More Videos Here:
Migration to Model:    • Let's Learn AdonisJS 5: Ep 5.5 - Database ...  
Schema to Migration:    • Let's Learn AdonisJS 5: Ep 5.4 - Database ...  
Migrations & Their Flow:    • Let's Learn AdonisJS 5: Ep 5.1 - Migration...  
Altering Tables With Migrations:    • Let's Learn AdonisJS 5: Ep 5.2 - Altering ...  
What Is A Model?:    • Let's Learn AdonisJS 5: Ep 5.3 - What Is A...  

🕑 Chapters
00:00 - Intro
00:30 - Relationship Types
01:30 - AdonisJS Relationship Lookup
02:30 - AdonisJS Relationship Decorators
03:20 - Belongs To (one-to-one)
04:15 - Has One (one-to-one)
05:20 - Relation Configuration Options
07:00 - Belongs To (many-to-one)
07:30 - Has Many (many-to-one)
08:00 - Relationship Model Names
09:30 - Many To Many
11:20 - Pivot Table & Pivot Columns
12:30 - Outro

-------------------------Socials--------------------------

🕸️ Website: https://adocasts.com
🐘 Mastodon: https://fosstodon.org/@adocasts
🐦 Twitter:   / adocasts  
📫 Post: https://post.news/tomgobich
👍 GitHub: https://github.com/adocasts