UserFilter.php 762 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class UserFilter extends Model
  5. {
  6. protected $fillable = [
  7. 'user_id',
  8. 'filterable_id',
  9. 'filterable_type',
  10. 'filter_type',
  11. ];
  12. public function mutedUserIds($profile_id)
  13. {
  14. return $this->whereUserId($profile_id)
  15. ->whereFilterableType('App\Profile')
  16. ->whereFilterType('mute')
  17. ->pluck('filterable_id');
  18. }
  19. public function blockedUserIds($profile_id)
  20. {
  21. return $this->whereUserId($profile_id)
  22. ->whereFilterableType('App\Profile')
  23. ->whereFilterType('block')
  24. ->pluck('filterable_id');
  25. }
  26. public function instance()
  27. {
  28. return $this->belongsTo(Instance::class, 'filterable_id');
  29. }
  30. }