fedi-feed-router/app/Http/Resources/FeedResource.php
myrmidex d2919758f5
All checks were successful
CI / ci (push) Successful in 5m52s
CI / ci (pull_request) Successful in 5m46s
Build and Push Docker Image / build (push) Successful in 4m6s
Fix Pint 1.29.0 lint issues and update CI workflow
2026-03-18 20:01:25 +01:00

38 lines
1 KiB
PHP

<?php
namespace App\Http\Resources;
use App\Models\Feed;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @mixin Feed
*/
class FeedResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'name' => $this->name,
'url' => $this->url,
'type' => $this->type,
'provider' => $this->provider,
'language_id' => $this->language_id,
'is_active' => $this->is_active,
'description' => $this->description,
'created_at' => $this->created_at->toISOString(),
'updated_at' => $this->updated_at->toISOString(),
'articles_count' => $this->when(
$request->routeIs('api.feeds.*') && isset($this->articles_count),
$this->articles_count
),
];
}
}