Follower.php 744 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Follower extends Model
  5. {
  6. protected $fillable = ['profile_id', 'following_id', 'local_profile'];
  7. const MAX_FOLLOWING = 7500;
  8. const FOLLOW_PER_HOUR = 150;
  9. public function actor()
  10. {
  11. return $this->belongsTo(Profile::class, 'profile_id', 'id');
  12. }
  13. public function target()
  14. {
  15. return $this->belongsTo(Profile::class, 'following_id', 'id');
  16. }
  17. public function profile()
  18. {
  19. return $this->belongsTo(Profile::class, 'following_id', 'id');
  20. }
  21. public function permalink($append = null)
  22. {
  23. $path = $this->actor->permalink("#accepts/follows/{$this->id}{$append}");
  24. return url($path);
  25. }
  26. }