You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelfed/app/Models/UserFilter.php

62 lines
2.1 KiB
PHTML

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
4 days ago
use Illuminate\Support\Carbon;
4 days ago
/**
* @property int $id
* @property int $user_id
* @property int $filterable_id
* @property string $filterable_type
* @property string $filter_type
4 days ago
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property-read Instance|null $instance
* @property-read Profile|null $user
*
4 days ago
* @method static \Illuminate\Database\Eloquent\Builder<static>|UserFilter newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|UserFilter newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|UserFilter query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|UserFilter whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|UserFilter whereFilterType($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|UserFilter whereFilterableId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|UserFilter whereFilterableType($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|UserFilter whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|UserFilter whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|UserFilter whereUserId($value)
4 days ago
*
4 days ago
* @mixin \Eloquent
*/
class UserFilter extends Model
{
protected $guarded = [];
public function mutedUserIds($profile_id)
{
9 months ago
return $this->whereUserId($profile_id)
->whereFilterableType(Profile::class)
9 months ago
->whereFilterType('mute')
->pluck('filterable_id');
}
public function blockedUserIds($profile_id)
{
9 months ago
return $this->whereUserId($profile_id)
->whereFilterableType(Profile::class)
9 months ago
->whereFilterType('block')
->pluck('filterable_id');
}
public function instance()
{
return $this->belongsTo(Instance::class, 'filterable_id');
}
public function user()
{
return $this->belongsTo(Profile::class, 'user_id');
}
}