Media being appended automatically #2606
Unanswered
amirasyraf
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm not quite sure if this is the package behaviour or it's Laravel's, but for some reason Media is getting appended automatically when I'm creating an accessor even though I haven't explicitly included it.
e.g.
When retrieving the model, this is being returned:
Where is
media
coming from? I have not explicitly defined in the model to have it included. If I removeimage_urls
from$appends
,media
is also not returned. So for some reason, calling thegetMedia()
somehow appends theMedia
object when retrieving a model?I have tried returning a dummy array, i.e. not calling
getMedia()
and it works as intended. Which kinda confirms my suspicion?Of course I can explicitly exclude
media
from being returned by adding it to$hidden
attribute, but is this an intended behaviour?Beta Was this translation helpful? Give feedback.
All reactions