pixelfed/app/Instance.php

69 lines
958 B
PHP
Raw Permalink Normal View History

2018-09-02 04:43:11 +00:00
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Instance extends Model
{
2019-01-20 23:25:12 +00:00
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'
);
}
2019-01-21 03:53:35 +00:00
public function getUrl()
{
return url("/i/admin/instances/show/{$this->id}");
}
2018-09-02 04:43:11 +00:00
}