Hamid Ghiasifar
Hamid Ghiasifar

Reputation: 47

use gallery image for multi-models in Laravel

Hi In may project I have tow models Post and Products And they have galleryimage my question is how can use one table for gallery to handle it?

or better way is using tow separate gallery table for each model like PostGallery and ProductGallery?

relation between gallery and post or product is one to many.

Upvotes: 0

Views: 74

Answers (1)

train_fox
train_fox

Reputation: 1537

There is some solutions, first you can make separate gallery for each model, second you can make a model for storing gallery and use morph relation on it for handling which model belongs item to it, third one is using spatie medialibrary package

Upvotes: 1

Related Questions