pixelfed/app/Follower.php

36 lines
744 B
PHP
Raw Permalink Normal View History

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Follower extends Model
{
2018-11-04 03:16:19 +00:00
protected $fillable = ['profile_id', 'following_id', 'local_profile'];
2019-06-02 02:18:21 +00:00
const MAX_FOLLOWING = 7500;
const FOLLOW_PER_HOUR = 150;
2019-06-02 02:18:21 +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-11-04 03:16:19 +00:00
public function permalink($append = null)
{
2018-12-21 19:51:25 +00:00
$path = $this->actor->permalink("#accepts/follows/{$this->id}{$append}");
return url($path);
}
}