<?php

namespace BenAllfree\Trackable\Models;

use Illuminate\Database\Eloquent\Model;

class Site extends Model
{
  protected $fillable = ['host'];
  
  function metas()
  {
    return $this->hasManyThrough(\ContactMeta::class, \Contact::class);
  }
  
  function currentMetas()
  {
    return $this->metas()->whereIsCurrent(true);
  }
  
  function contacts()
  {
    return $this->hasMany(\Contact::class);
  }
  
  function contactsWith($meta_key, $meta_value)
  {
    return $this->contacts()->whereMeta($meta_key, '=', $meta_value);
  }
}

<?php

namespace BenAllfree\Trackable\Models;

class Site extends \TrackableModelBase
{
  protected $fillable = ['host'];

  public function metas()
  {
    return $this->hasManyThrough(\ContactMeta::class, \Contact::class);
  }

  public function currentMetas()
  {
    return $this->metas()->whereIsCurrent(true);
  }

  public function contacts()
  {
    return $this->hasMany(\Contact::class);
  }

  public function contactsWith($meta_key, $meta_value)
  {
    return $this->contacts()->whereMeta($meta_key, '=', $meta_value);
  }
}

Use Alias so Model base class can be changed
Use Alias so Model base class can be changed
