Closed mdeprezzo closed 5 years ago
Hey @mdeprezzo
Can you please provide a more substantial example? Code snippets appreciated.
@specialtactics sure, maybe I misunderstood the availableIncludes option. But, if i tried to include something that isn't a model relation i got that error. Example:
i've a custom method inside model that return an array of files from s3.
So i define that:
$availableIncludes = [
'images'
]
public function includeImages(Model $model)
{
return $model->getImages()
}
Hi @mdeprezzo
The includes actually get eventually passed to eloquent's with() function, so it won't work if it's just your own function that returns an array - they have to be actual relations.
Because you essentially just want to attach arbitrary data if a certain query param is set, so you can implement that logic yourself.
@specialtactics I'm sure, that in past version could add some custom includes, and i already did. Btw, thanks for reply
Actual Behaviour
When i try to include something, that isn't a model relationship got that error. This is strange, because on dingo 2.0.0-alpha1 i do that, and all works fine.
Expected Behaviour
Return the data from custom includes
Steps to Reproduce
Define a custom include. Meaning, that the data to includes comes to the custom incude define on