forked from mirror/pixelfed
Update follower model, add new methods
This commit is contained in:
parent
e4ebd474ff
commit
95dcf8f7b3
1 changed files with 28 additions and 1 deletions
|
@ -6,5 +6,32 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Follower extends Model
|
class Follower extends Model
|
||||||
{
|
{
|
||||||
//
|
public function actor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Profile::class, 'profile_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function target()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Profile::class, 'following_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function profile()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Profile::class, 'following_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toText()
|
||||||
|
{
|
||||||
|
$actorName = $this->actor->username;
|
||||||
|
return "{$actorName} " . __('notification.startedFollowingYou');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toHtml()
|
||||||
|
{
|
||||||
|
$actorName = $this->actor->username;
|
||||||
|
$actorUrl = $this->actor->url();
|
||||||
|
return "<a href='{$actorUrl}' class='profile-link'>{$actorName}</a> " .
|
||||||
|
__('notification.startedFollowingYou');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue