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-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;
|
2020-12-28 01:15:10 +00:00
|
|
|
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-10-10 01:21:45 +00:00
|
|
|
{
|
2018-12-21 19:51:25 +00:00
|
|
|
$path = $this->actor->permalink("#accepts/follows/{$this->id}{$append}");
|
2018-10-10 01:21:45 +00:00
|
|
|
return url($path);
|
|
|
|
}
|
2018-04-16 00:52:22 +00:00
|
|
|
}
|