diff --git a/app/Instance.php b/app/Instance.php index d4c73917a..3236819fe 100644 --- a/app/Instance.php +++ b/app/Instance.php @@ -6,5 +6,58 @@ use Illuminate\Database\Eloquent\Model; class Instance extends Model { - protected $fillable = ['domain']; + protected $fillable = ['domain']; + + public function profiles() + { + return $this->hasMany(Profile::class, 'domain', 'domain'); + } + + public function statuses() + { + return $this->hasManyThrough( + Status::class, + Profile::class, + 'domain', + 'profile_id', + 'domain', + 'id' + ); + } + + public function reported() + { + return $this->hasManyThrough( + Report::class, + Profile::class, + 'domain', + 'reported_profile_id', + 'domain', + 'id' + ); + } + + public function reports() + { + return $this->hasManyThrough( + Report::class, + Profile::class, + 'domain', + 'profile_id', + 'domain', + 'id' + ); + } + + public function media() + { + return $this->hasManyThrough( + Media::class, + Profile::class, + 'domain', + 'profile_id', + 'domain', + 'id' + ); + } }