Open Mina-R-Meshriky opened 3 years ago
Thanks for submitting this. I'm going to have to take a detailed look at it and add tests before I'm happy to merge. I've been really short on open source time recently, but am starting to pick things up again. So hopefully I can get to this sometime in the next month.
Great feature! this is exactly where i was looking for!
@lindyhopchris , any update on this? Because i want to use it but only if its supported by the package. Not as long as its only a open pull request.
Yeah I've thought about this a bit and my preference would be to do this via existing JSON:API semantics. I believe the spec gives us everything we need to do pivots via intermediary resources. Which also comes with the advantage of the client being able to control things via include paths and sparse fieldsets - which we don't get if we do it via a custom implementation that uses meta.
However, I need to sit down and work my way through a scenario and check that it all works. And if it does then I need to write it up as the definitive way to do it, so that I stop getting constant questions about pivots!! Unfortunately none of the production apps that I have using Laravel JSON:API use pivot values anywhere, which is why I've been slow to write something up.
issue laravel-json-api/laravel#114 if in the request of many-to-many the relationship data contained mata.pivot it will be inserted in the pivot table
in schema:
for validation: