i.e.:
For example, a blog Post and a User may share a polymorphic relation to an Image model.
@ivanwitzke This is where I'm confused. In this sentence, I hear a Post and a User object store their data within a single Image data, and you're using the relationship in Image to relate back either a Post and User. It sounds like a simple one-to-one relationship vs polymorphism, i.e. an "image type" of UserImage and PostImage containing data unique to both of those, "extending" the base Image object. Do you follow what I was seeing? To be more specific, I was looking for "imageable" to pull things like "type_jpeg" with jpeg meta, vs "type_svg" with svg meta, or "type_gif" with gif specifics (speed, length, etc).
That's my biggest confusion. The examples look like a standard one-to-one relationship.
@snapey Your post, however, using the idea of User Profiles is exactly what I was thinking about: the "imageable" relationships are an extension of, not "belong to", the profile, i.e. your main User object as all the user data, and the different profile types include different data based on which profile_type is associated.
When changing up the demo model with my scenario, I can see how they are "the same thing" in practice, but (in my view) different in concept:
erp_a
id - integer
name - string
unique_to_A - string
erp_b
id - integer
name - string
unique_to_B - string
organzation
id - integer
name - string
owner - string
erp_type_id - integer
erp_type - string // Models\ErpA or Models\ErpB
// storing in `erp` property
In this instance, the erp is now a polymorphic object with the extended fields for that specific erp type instance -- A or B.