Open DrRamazzotti opened 10 months ago
Hey @DrRamazzotti could you please provide some code examples of your models and the route you are calling?
Hi Max,
In the meantime I got a glue.
vendor/specialtactics/l5-api/src/Transformers/RestfulTransformer.php
There is the issue
Lines 232 to 234
// We don't really care about pivot information at this stage if (isset($transformedRelatedModel['pivot'])) { unset($transformedRelatedModel['pivot']); }
Its just coded that while transformation it's removed
Bernhard
Von: Max @.> Gesendet: Sonntag, 11. Februar 2024 10:40 An: specialtactics/laravel-api-boilerplate @.> Cc: DrRamazzotti @.>; Mention @.> Betreff: Re: [specialtactics/laravel-api-boilerplate] WithPivot removed during transformation (Issue #71)
Hey @DrRamazzottihttps://github.com/DrRamazzotti could you please provide some code examples of your models and the route you are calling?
— Reply to this email directly, view it on GitHubhttps://github.com/specialtactics/laravel-api-boilerplate/issues/71#issuecomment-1937494186, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AELGECWHFUIJD5DERTYPLW3YTCGZTAVCNFSM6AAAAABB2D37CSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZXGQ4TIMJYGY. You are receiving this because you were mentioned.
Hey @DrRamazzotti - happy to work on this, but can you give me some examples of how you are using pivots? Can you post some example models and a controller code and what you expect?
I have a many to many relation with additional fields.
It works fine until I try to query a item or collection with additional fields.
Return the "pure" raw item the additional pivot fields are there.
Using return $this->response->item($company, $this->getTransformer()); the additional fields wont appear.