2018-04-16 00:52:22 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
2018-04-18 02:17:30 +00:00
|
|
|
class Follower extends Model
|
2018-04-16 00:52:22 +00:00
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
2018-10-10 01:21:45 +00:00
|
|
|
public function permalink()
|
|
|
|
{
|
|
|
|
$path = $this->actor->permalink("/follow/{$this->id}");
|
|
|
|
return url($path);
|
|
|
|
}
|
|
|
|
|
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');
|
|
|
|
}
|
2018-04-16 00:52:22 +00:00
|
|
|
}
|