2018-07-18 00:05:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
class UserFilter extends Model
|
|
|
|
{
|
2018-08-23 04:23:19 +00:00
|
|
|
protected $fillable = [
|
2018-08-28 03:07:36 +00:00
|
|
|
'user_id',
|
|
|
|
'filterable_id',
|
|
|
|
'filterable_type',
|
|
|
|
'filter_type',
|
2018-08-23 04:23:19 +00:00
|
|
|
];
|
2018-08-31 03:43:43 +00: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 19:55:57 +00:00
|
|
|
|
|
|
|
public function instance()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Instance::class, 'filterable_id');
|
|
|
|
}
|
2023-12-21 06:55:26 +00:00
|
|
|
|
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Profile::class, 'user_id');
|
|
|
|
}
|
2018-07-18 00:05:37 +00:00
|
|
|
}
|