Polymorphic Relations In Laravel
anyone can explain about larvel polymorphic relationship?
"A polymorphic relationship allows the target model to belong to more than one type of model using a single association."
That means you can associate one(1) table (Model) for different situations.
Ex : Facebook has comments for Images and Videos, In the backend Facebook only has one "comments" table for both Images & Videos.
And also this relationship can work with other relationships in Eloquent ORM
- One To One (Polymorphic)
- One To Many (Polymorphic)
- Many To Many (Polymorphic)
thank you bro, can you post sample code snippet for model?
@fern you can find it on below url..
thank you, I'll find out :smile: