title: laravel 5 how to add to $with / $appends fields in child model class
body: <p>I have several models which share some common functionality (due to their polymorphism) which I'd like to pull into a ResourceContentModel class (or even a trait).</p>
  
  <p>The ResourceContentModel class would extend the eloquent Model class and my individual models would then extend ResourceContentModel.</p>
  
  <p>My question is around the model fields like $with, $appends and $touches. If I make use of these for any of the common functionality in ResourceContentModel, then when I redefine them in my child model class, it overwrites the values I've set in my parent class. </p>
  
  <p>Looking for some suggestions for a clean way around this?</p>
  
  <p>For example:</p>
  
  <pre><code>class ResourceContentModel extends Model
  {
      protected $with = ['resource']
      protected $appends = ['visibility']
  
      public function resource()
      {
          return $this-&gt;morphOne(Resource::class, 'content');
      }
  
      public function getVisibilityAttribute()
      {
          return $this-&gt;resource-&gt;getPermissionScope(Permission::RESOURCE_VIEW);
      }
  }
  
  class Photo extends ResourceContentModel
  {
      protected $with = ['someRelationship']
      protected $appends = ['some_other_property']
  
      THESE ARE A PROBLEM AS I LOSE THE VALUES IN ResourceContentModel
  }
  </code></pre>
  
  <p>I'm after a clean way to do this so the child classes aren't overly changed by the fact I've slotted in an extra class in the hierarchy to gather the common code.</p>