1
0
Fork 0

Update Profile model

This commit is contained in:
Daniel Supernault 2018-09-23 17:25:33 -06:00
parent d0cd22f5b4
commit 2982182b3d
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 24 additions and 0 deletions

View File

@ -196,6 +196,30 @@ class Profile extends Model
->pluck('filterable_id');
}
public function blockedIds()
{
return UserFilter::whereUserId($this->id)
->whereFilterableType('App\Profile')
->whereFilterType('block')
->pluck('filterable_id');
}
public function mutedProfileUrls()
{
$ids = $this->mutedIds();
return $this->whereIn('id', $ids)->get()->map(function($i) {
return $i->url();
});
}
public function blockedProfileUrls()
{
$ids = $this->blockedIds();
return $this->whereIn('id', $ids)->get()->map(function($i) {
return $i->url();
});
}
public function reports()
{
return $this->hasMany(Report::class, 'profile_id');