You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to hook an observer to my model which has media. I will send my created model to an external API with its images so I made a created observer and send the model along with $model->getMedia('collectionName');
But it actually sends an empty array for the media. then I look in the database I find that the media has been created and existing.
I ran it in a queue to see what happens and it sends the real media array if it's in queue. But I want this to happen without a queue too?!
So how can I retrieve its media immediately after model is created?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to hook an observer to my model which has media. I will send my created model to an external API with its images so I made a created observer and send the model along with
$model->getMedia('collectionName');
But it actually sends an empty array for the media. then I look in the database I find that the media has been created and existing.
I ran it in a queue to see what happens and it sends the real media array if it's in queue. But I want this to happen without a queue too?!
So how can I retrieve its media immediately after model is created?
Beta Was this translation helpful? Give feedback.
All reactions