How To Add A Custom Method to the Model Query Builder in AdonisJS

Опубликовано: 15 Март 2026
на канале: Adocasts
1,694
17

In this lesson, we'll learn how to define a macro for the Model Query Builder within an AdonisJS project to provide a new method onto all our Model's Query Builder. We'll also add a custom method inspired by Laravel called "firstOr", which will allow us to define our own fallback value if a first query result cannot be found.

― Lesson: https://jagr.co/lessons/how-to-add-a-...
― Series: https://jagr.co/series/adonisjs-quick...
― Repository: https://github.com/jagr-co/adonisjs-m...
― Newsletter: https://www.getrevue.co/profile/jagr_co/

Social Media:
― Website: https://jagr.co
― Twitter:   / jagr_co  
― GitHub: https://github.com/jagr-co