The medialibrary package seems to work very well when it's a simple model to media relationship. But is it possible to have a central media library (similar to WordPress) which any model can reference?
For example:
I understand that once the image is in the library it is given an ID so I can reference that from the other models, but the bit I'm unsure of is how to handle the upload and whether to create a 'MediaLibrary' model that the images attach to.
Has anyone done this? Can anyone share some tips?
Reading the article here: https://murze.be/comparing-laravel-mediable-with-laravel-medialibrary I'm realising that Spatie's medialibrary really is designed to explicitly not support what I'm hoping to do.
I guess my question is, can this be done with a reasonable workaround (a not-too-bodgy bodge)?
@riseoflex88 I think you can do what you want by attaching your medias to the user model within a “uploads” collection. Then select the media and copy/move it to your other model
Most helpful comment
@riseoflex88 I think you can do what you want by attaching your medias to the user model within a “uploads” collection. Then select the media and copy/move it to your other model