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/AdminShadowFilter.php

35 lines
734 B
PHTML

<?php
namespace App\Models;
9 months ago
use App\Services\AccountService;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class AdminShadowFilter extends Model
{
use HasFactory;
protected $guarded = [];
7 months ago
protected function casts(): array
{
return [
'created_at' => 'datetime',
];
}
public function account()
{
3 weeks ago
if (in_array($this->item_type, ['App\Profile', 'App\Models\Profile'])) {
return AccountService::get($this->item_id, true);
}
}
public function profile(): BelongsTo
{
return $this->belongsTo(Profile::class, 'item_id');
}
}