One table is used by multiple models.

 

  • User has images
  • Profile also has images

 

User Model:

<?php
public function images()
{
    return $this->morphMany(Image::class, 'imageable');
}
?>

Image Model:

<?php
public function imageable()
{
    return $this->morphTo();
}
?>