1
0
Fork 0
pixelfed/app/Follower.php

40 lines
850 B
PHP
Raw Normal View History

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Follower extends Model
{
2018-05-30 03:02:24 +00:00
public function actor()
{
2018-08-28 03:07:36 +00:00
return $this->belongsTo(Profile::class, 'profile_id', 'id');
2018-05-30 03:02:24 +00:00
}
public function target()
{
2018-08-28 03:07:36 +00:00
return $this->belongsTo(Profile::class, 'following_id', 'id');
2018-05-30 03:02:24 +00:00
}
public function profile()
{
2018-08-28 03:07:36 +00:00
return $this->belongsTo(Profile::class, 'following_id', 'id');
2018-05-30 03:02:24 +00:00
}
public function toText()
{
2018-08-28 03:07:36 +00:00
$actorName = $this->actor->username;
return "{$actorName} ".__('notification.startedFollowingYou');
2018-05-30 03:02:24 +00:00
}
public function toHtml()
{
2018-08-28 03:07:36 +00:00
$actorName = $this->actor->username;
$actorUrl = $this->actor->url();
return "<a href='{$actorUrl}' class='profile-link'>{$actorName}</a> ".
2018-05-30 03:02:24 +00:00
__('notification.startedFollowingYou');
}
}