pixelfed/app/Instance.php

69 lines
1,000 B
PHP
Raw Normal View History

2018-09-02 04:43:11 +00:00
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Instance extends Model
{
2023-03-19 11:29:54 +00:00
protected $fillable = ['domain', 'banned', 'auto_cw', 'unlisted', 'notes'];
2019-01-20 23:25:12 +00:00
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
}