plank / laravel-mediable

Laravel-Mediable is a package for easily uploading and attaching media files to models with Laravel
MIT License
773 stars 101 forks source link

Move media to root directory #328

Closed richardhedges closed 1 year ago

richardhedges commented 1 year ago

When uploading media, I'm able to leave the directory as default, which leaves the directory column empty.

If I upload media to a directory, and wish to move it to the root (i.e. empty directory), using the move method, I see the following error: Plank\Mediable\Media::move(): Argument #1 ($destination) must be of type string, null given.

As far as I can see there's no valid method to move a media item back to the disk's root directory.

frasmage commented 1 year ago

Have you tried passing empty string ('') to the directory argument?

On Tue, Aug 29, 2023, 11:51 a.m. Richard Hedges @.***> wrote:

When uploading media, I'm able to leave the directory as default, which leaves the directory column empty.

If I upload media to a directory, and wish to move it to the root (i.e. empty directory), using the move method, I see the following error: Plank\Mediable\Media::move(): Argument #1 ($destination) must be of type string, null given.

As far as I can see there's no valid method to move a media item back to the disk's root directory.

— Reply to this email directly, view it on GitHub https://github.com/plank/laravel-mediable/issues/328, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG7ZLFXFXV635RZUGHN5HDXXYFYLANCNFSM6AAAAAA4DFPQQA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

richardhedges commented 1 year ago

Apologies, my fresh eyes on the code allowed me to realise I'd made a mix up outside of Mediable. The empty string does indeed work.