Closed esadewater closed 1 week ago
@esadewater would you mind adding a unit test that makes sure both id
and a custom id
value continue to work as expected? Thanks!
@patinthehat Sure, I've added a unit test for a media model with a custom key name.
Thanks for the PR!
This PR attempts to fix file renaming when using a custom model with a primary key name other than 'id'.
We use a custom model that changes the primary key name from
id
tomedia_id
:We want to rename a file as described in the docs (Retrieving media):
When renaming file
src/MediaCollections/Filesystem.php
tries to find a media model using theid
attribute instead of the actual primary key. This PR fixes this bug by using->getKey()
in this specific place, which works in both cases.