Closed bryanjamesmiller closed 3 years ago
Thanks Bryan, I'm not aware of any direct incompatibility with MorphMany relationship as the child models get created the same way like HasMany.
Maybe your issue with Spatie Media Liberary is that the media()
MorphMany relationship needs other data to be passed to create method to fulfill the DB table requirements https://github.com/spatie/laravel-medialibrary/blob/master/database/migrations/create_media_table.php.stub
Can you explain more what kind of error you get? And how is your implementation?
Thanks for the quick responses. It turns out we can just rip out the Spatie Media Library, as at this point it adds an unnecessary layer in our app. It may work as you suggest, I didn't even try it because I didn't see MorphMany listed in the docs as an available option, so I assumed it was not supported. I'm glad to see it might be possible though - you may want to add MorphMany to the docs! Thanks again!
If anyone is interested in implementing this themselves (I'm using it mainly to use Spatie's conversions), you can do the following:
Thanks again for the great library!
Perhaps I am mistaken, but your package currently not compatible with the Spatie Media library? The Spatie Media library uses MorphMany relationship - any chance of implementing a connection there?