One of my models have a many-to-many relationship with pivot values. I want them to be included in the relationship on the resource object.
With the help of laraveljsonapi package documentation and AI, I found that I am supposed to put the pivot values in the meta object of my relationship, however I can't find in Laravel documentation how to do it.
Does someone know how to put meta information on a relationship object using Laravel native JSON:API resource feature?
The v13 native JSON:API implementation is solid, but the docs are definitely a bit light on the deeper relationship customizations right now.
You can chain the meta() method directly onto your relationship definition. Since you're dealing with pivot values, you can pass a closure to meta() which receives the related model, allowing you to pull those pivot fields dynamically.
However, meta() is a function from the laraveljsonapi package, I don't think it exists in native Laravel 13. Moreover, I don't understand how I'm supposed to "chain it on my relationship definition" because the definition is litteraly just a string or callable.