2018-09-02 04:28:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
class FollowRequest extends Model
|
|
|
|
{
|
2022-06-03 07:29:50 +00:00
|
|
|
protected $fillable = ['follower_id', 'following_id', 'activity', 'handled_at'];
|
|
|
|
|
|
|
|
protected $casts = [
|
|
|
|
'activity' => 'array',
|
|
|
|
];
|
2022-06-03 10:18:06 +00:00
|
|
|
|
|
|
|
public function actor()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Profile::class, 'follower_id', 'id');
|
|
|
|
}
|
2018-09-03 04:00:54 +00:00
|
|
|
|
2018-09-02 04:28:01 +00:00
|
|
|
public function follower()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Profile::class, 'follower_id', 'id');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function following()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Profile::class, 'following_id', 'id');
|
|
|
|
}
|
2019-01-01 06:25:00 +00:00
|
|
|
|
|
|
|
public function target()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Profile::class, 'following_id', 'id');
|
|
|
|
}
|
2022-06-03 07:29:50 +00:00
|
|
|
|
|
|
|
public function permalink($append = null)
|
|
|
|
{
|
|
|
|
$path = $this->target->permalink("#accepts/follows/{$this->id}{$append}");
|
|
|
|
return url($path);
|
|
|
|
}
|
2018-09-02 04:28:01 +00:00
|
|
|
}
|