From c2635fa1073859600f1dc15fbdded349fc199b9e Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 20 Jan 2019 16:25:12 -0700 Subject: [PATCH] Update Instance model --- app/Instance.php | 55 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) 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' + ); + } }