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
Has there been an update on this functionality recently? I am sure that used to work differently.
In my model I have
public function registerMediaCollections(): void
{
$this->addMediaCollection('main')
->withResponsiveImagesIf(true)
->singleFile();
}
And in the controller $this->model->addMedia($validated['image'])->toMediaCollection('main');.
I would expect that when I am updating the model the original collection 'main' that has only 1 file allowed to be deleted and the new one be uploaded and swapped and as far as I remember it used to work that way - please, correct me if wrong. But now the new file is added to the main collection and the database model record does not get updated with the new 'main'. It does start working as intended once I added $this->model->clearMediaCollection('main');. My impression is that using the singleFile method should call the clearMediaCollection automatically.
Any suggestion on what might have been updated and what I might have missed?
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.
-
Has there been an update on this functionality recently? I am sure that used to work differently.
In my model I have
And in the controller
$this->model->addMedia($validated['image'])->toMediaCollection('main');
.I would expect that when I am updating the model the original collection 'main' that has only 1 file allowed to be deleted and the new one be uploaded and swapped and as far as I remember it used to work that way - please, correct me if wrong. But now the new file is added to the main collection and the database model record does not get updated with the new 'main'. It does start working as intended once I added
$this->model->clearMediaCollection('main');
. My impression is that using the singleFile method should call the clearMediaCollection automatically.Any suggestion on what might have been updated and what I might have missed?
Beta Was this translation helpful? Give feedback.
All reactions