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/Http/Resources/AdminSpamReport.php

43 lines
992 B
PHTML

<?php
namespace App\Http\Resources;
use App\Models\Status;
9 months ago
use App\Services\StatusService;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
4 weeks ago
use Illuminate\Support\Carbon;
/**
* @property int $id
* @property string $type
* @property int|null $item_id
* @property string|null $item_type
4 weeks ago
* @property Carbon|null $read_at
* @property Carbon $created_at
*/
class AdminSpamReport extends JsonResource
{
9 months ago
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
$res = [
'id' => $this->id,
'type' => $this->type,
'status' => null,
'read_at' => $this->read_at,
'created_at' => $this->created_at,
];
4 weeks ago
if ($this->item_id && $this->item_type === Status::class) {
9 months ago
$res['status'] = StatusService::get($this->item_id, false);
}
9 months ago
return $res;
}
}