mirror of https://github.com/pixelfed/pixelfed
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.0 KiB
PHTML
49 lines
1.0 KiB
PHTML
|
9 years ago
|
<?php
|
||
|
|
|
||
|
4 weeks ago
|
namespace App\Models;
|
||
|
9 years ago
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
4 weeks ago
|
use Illuminate\Support\Carbon;
|
||
|
9 years ago
|
|
||
|
10 months ago
|
/**
|
||
|
|
* @property int $id
|
||
|
|
* @property int $profile_id
|
||
|
|
* @property int $following_id
|
||
|
|
* @property bool|null $local_profile
|
||
|
4 weeks ago
|
* @property Carbon|null $created_at
|
||
|
|
* @property Carbon|null $updated_at
|
||
|
|
* @property-read Profile $actor
|
||
|
|
* @property-read Profile $target
|
||
|
|
* @property-read Profile $profile
|
||
|
10 months ago
|
*/
|
||
|
9 years ago
|
class Follower extends Model
|
||
|
9 years ago
|
{
|
||
|
4 weeks ago
|
protected $guarded = [];
|
||
|
8 years ago
|
|
||
|
7 years ago
|
const MAX_FOLLOWING = 7500;
|
||
|
9 months ago
|
|
||
|
6 years ago
|
const FOLLOW_PER_HOUR = 150;
|
||
|
7 years ago
|
|
||
|
8 years ago
|
public function actor()
|
||
|
|
{
|
||
|
8 years ago
|
return $this->belongsTo(Profile::class, 'profile_id', 'id');
|
||
|
8 years ago
|
}
|
||
|
|
|
||
|
|
public function target()
|
||
|
|
{
|
||
|
8 years ago
|
return $this->belongsTo(Profile::class, 'following_id', 'id');
|
||
|
8 years ago
|
}
|
||
|
|
|
||
|
|
public function profile()
|
||
|
|
{
|
||
|
8 years ago
|
return $this->belongsTo(Profile::class, 'following_id', 'id');
|
||
|
8 years ago
|
}
|
||
|
|
|
||
|
8 years ago
|
public function permalink($append = null)
|
||
|
8 years ago
|
{
|
||
|
8 years ago
|
$path = $this->actor->permalink("#accepts/follows/{$this->id}{$append}");
|
||
|
9 months ago
|
|
||
|
8 years ago
|
return url($path);
|
||
|
|
}
|
||
|
9 years ago
|
}
|