Closed khanakia closed 1 year ago
I am not getting why Plank does not expose any interface HasMedia now it's so hard to type hint the code e.g.
function (SpatieMediaLibraryFileUpload $component, HasMedia $record)
Hello @khanakia,
This library does not follow the same method signatures as Spatie's media library, so we cannot adhere to the same interface, if that is what you are implying. The library that you linked looks like an adaptor, so you might want to create your own which adapts Mediable instead.
There definitely could be an interface for the methods exposed by the Mediable
trait. This is the first time this has been requested. Pull requests always welcome! That said, there is also nothing stopping you from implementing such an interface in your own userland code and applying it to the same models that you are applying the Mediable
trait.
thanks, i will check
Hi,
I am trying to build a Filament Component using Plank but i am unable to do so as plank mediable does not expose any HasMedia kind of interface like spatie does https://github.com/spatie/laravel-medialibrary/blob/main/src/HasMedia.php
In order to make my component i need an interface as shown on this line https://github.com/filamentphp/spatie-laravel-media-library-plugin/blob/3.x/src/Forms/Components/SpatieMediaLibraryFileUpload.php#L46
Any help would be appreciated thanks