flugg / laravel-responder

A Laravel Fractal package for building API responses, giving you the power of Fractal with Laravel's elegancy.
MIT License
860 stars 86 forks source link

Relationship not using custom resourcekey when loaded data #142

Open wukongrita opened 5 years ago

wukongrita commented 5 years ago

Hi @flugger, this is an awesome project!

Btw; I have 2 models that related to each other with custom resourcekey, but I cannot have my custom resourcekey for the related model. What I've got is what I've define in the transformer ($load) as the resourcekey not the custom resourcekey that I already defined in getResourceKey() of the models.

Is there a way to use the getResourceKey() as the custom resourcekey on the relational ?

flugg commented 5 years ago

Hi @wukongrita, thanks for the kind words. Do I understand you correctly in that you rather have the getResourceKey take precedence over the keys in the $load property?

wukongrita commented 5 years ago

yes... or maybe there is a variable to set which keys that i would like to use? (either the getResourcekey or $load)