How To Use AdonisJS Model Hooks To Log All User Actions

Опубликовано: 06 Октябрь 2024
на канале: Adocasts
1,014
22

In this lesson, we’ll be taking a look at how we can log any and every user action performed against our AdonisJS models.

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

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

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

🚨 Looking for more? Check our Melchyore's Lucid Observer package: https://github.com/Melchyore/adonis-l...

🎬 Check Out More Videos Here:
Adonis + Nuxt API Auth:    • AdonisJS 5 API & Nuxt 3 SSR Authentic...  
Expired Auth Session:    • Gracefully Checking and Handling An E...  
Installing HTMX:    • HTMX & AdonisJS Filters: Ep. 1 - Inst...  
Query Builder Macros:    • Exploring My Favorite AdonisJS Model ...  

🕑 Chapters
00:00 - Available Hooks
00:56 - Hook Binding Method 1 (Decorators)
01:25 - Hook Binding Method 2 (Boot Method)
02:22 - Use Async Local Storage
02:50 - Getting The Base Model
03:17 - Expanding The Boot Method
04:04 - Defining Global Hooks
04:50 - Getting Auth User From HttpContext
06:45 - Inspecting What We've Got So Far
07:10 - Adding Update and Delete Logs
08:20 - Testing Our Logs
09:29 - Using The AdonisJS Logger

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

🕸️ Website: https://adocasts.com
🐘 Mastodon: https://fosstodon.org/@adocasts
🐦 Twitter:   / adocasts  
👍 GitHub: https://github.com/adocasts