Update Instance model

This commit is contained in:
Daniel Supernault 2019-01-20 16:25:12 -07:00
parent 530b234f40
commit c2635fa107
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -6,5 +6,58 @@ use Illuminate\Database\Eloquent\Model;
class Instance extends 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'
);
}
} }