2018-07-17 18:05:37 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
class UserFilter extends Model
|
|
|
|
{
|
2018-08-22 22:23:19 -06:00
|
|
|
protected $fillable = [
|
2018-08-28 03:07:36 +00:00
|
|
|
'user_id',
|
|
|
|
'filterable_id',
|
|
|
|
'filterable_type',
|
|
|
|
'filter_type',
|
2018-08-22 22:23:19 -06:00
|
|
|
];
|
2018-08-30 21:43:43 -06:00
|
|
|
|
|
|
|
public function mutedUserIds($profile_id)
|
|
|
|
{
|
|
|
|
return $this->whereUserId($profile_id)
|
|
|
|
->whereFilterableType('App\Profile')
|
|
|
|
->whereFilterType('mute')
|
|
|
|
->pluck('filterable_id');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function blockedUserIds($profile_id)
|
|
|
|
{
|
|
|
|
return $this->whereUserId($profile_id)
|
|
|
|
->whereFilterableType('App\Profile')
|
|
|
|
->whereFilterType('block')
|
|
|
|
->pluck('filterable_id');
|
|
|
|
}
|
2019-01-31 12:55:57 -07:00
|
|
|
|
|
|
|
public function instance()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Instance::class, 'filterable_id');
|
|
|
|
}
|
2023-12-20 23:55:26 -07:00
|
|
|
|
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Profile::class, 'user_id');
|
|
|
|
}
|
2018-07-17 18:05:37 -06:00
|
|
|
}
|