Closed drnkwtr closed 5 months ago
public function selectThumbnail($mod_id, $file_id)
{
$media = Media::find($file_id)->copy(Modification::find($mod_id),'thumbnail');
$media->order_column = 1;
$media->save();
return back();
}
This is the fix of this issue. I think, new media should be copied with order_column depends on count of collection medias.
@drnkwtr I'd be happy to take a look at a PR with failing unit tests that show the issue, as all of the tests are currently passing. Thanks! :+1:
I registered 2 media collections:
Then uploading some images by
And then selecting thumbnail by this (copied image replaces thumbnail for newer)
But for some reason copying to another collection works weird. I can copy file with incrementing id's, but can't with decrementing id's.
Example: uploaded 4 files with id=1, id=2, id=3, id=4. Selecting thumbnail with id=1 - ok, selecting id=2 - ok, selecting id=3 - ok, but now i can't choose thumbnail with file id=1 and id=2, only higher than selected id now
Is it only my fault or actually bug?
UPD: Seems like that problem is described here: issue