mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-27 10:16:47 +00:00
Merge pull request #440 from pixelfed/frontend-ui-refactor
Update Profile model
This commit is contained in:
commit
3da299cae0
1 changed files with 22 additions and 4 deletions
|
@ -101,14 +101,14 @@ class Profile extends Model
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function follows($profile)
|
public function follows($profile) : bool
|
||||||
{
|
{
|
||||||
return Follower::whereProfileId($this->id)->whereFollowingId($profile->id)->count();
|
return Follower::whereProfileId($this->id)->whereFollowingId($profile->id)->exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function followedBy($profile)
|
public function followedBy($profile) : bool
|
||||||
{
|
{
|
||||||
return Follower::whereProfileId($profile->id)->whereFollowingId($this->id)->count();
|
return Follower::whereProfileId($profile->id)->whereFollowingId($this->id)->exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bookmarks()
|
public function bookmarks()
|
||||||
|
@ -187,4 +187,22 @@ class Profile extends Model
|
||||||
|
|
||||||
return $this->permalink('#main-key');
|
return $this->permalink('#main-key');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function mutedIds()
|
||||||
|
{
|
||||||
|
return UserFilter::whereUserId($this->id)
|
||||||
|
->whereFilterableType('App\Profile')
|
||||||
|
->whereFilterType('mute')
|
||||||
|
->pluck('filterable_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reports()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Report::class, 'profile_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function media()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Media::class, 'profile_id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue