title: Retrieve parent class within morph relationship
body: <p>I have this code</p>
  
  <pre><code>//ImageableTrait
  trait ImageableTrait
  {
      public function images()
      {
          return $this-&gt;morphMany(Image::class, 'imageable')
              -&gt;orderBy('order', 'ASC');
      }
  }
  
  //User
  class User extend Model
  {
      use ImageableTrait;
  }
  
  //Post
  class Post extend Model
  {
      use ImageableTrait;
  }
  
  class ImageCollection extends Collection
  {
      public function firstOrDefault()
      {
          if ($this-&gt;count() === 0) {
              $image = new Image();
              $image-&gt;id = 'default';
              $image-&gt;imageable_type = '/* I need the parent className here */';
              $image-&gt;imageable_id = '.';
          }
  
          return $this-&gt;first();
      }
  }
  
  //Image
  class Image extend Model
  {
      public function imageable
      {
          return $this-&gt;morphTo();
      }
  
      public function newCollection(array $models = [])
      {
          return new ImageCollection($models);
      }
  
      public function path($size)
      {
          //Here, there is some logic to build the image path and it needs
          //the imageable_type attribute no matter if there is
          //an image record in the database or not
          return;
      }
  }
  </code></pre>
  
  <p>I want to be able to do so</p>
  
  <pre><code>$path = User::find($id)-&gt;images-&gt;firstOrDefault()-&gt;path('large');
  </code></pre>
  
  <p>But I can't figure out how to get the parent class name to build the path properly...</p>
  
  <p>I tried with $morphClass or getMorphClass() but can't figure out how to use it properly or if it is even the right way to do it.</p>
  
  <p>Any thoughts on that?</p>