39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\RouteArticle;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/**
|
|
* @mixin RouteArticle
|
|
*/
|
|
class RouteArticleResource extends JsonResource
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'feed_id' => $this->feed_id,
|
|
'platform_channel_id' => $this->platform_channel_id,
|
|
'article_id' => $this->article_id,
|
|
'approval_status' => $this->approval_status->value,
|
|
'publish_status' => $this->publish_status->value,
|
|
'validated_at' => $this->validated_at?->toISOString(),
|
|
'created_at' => $this->created_at->toISOString(),
|
|
'updated_at' => $this->updated_at->toISOString(),
|
|
'article' => [
|
|
'id' => $this->article->id,
|
|
'title' => $this->article->title,
|
|
'url' => $this->article->url,
|
|
'description' => $this->article->description,
|
|
'feed_name' => $this->article->feed->name,
|
|
],
|
|
'route_name' => $this->feed->name.' → '.$this->platformChannel->name,
|
|
];
|
|
}
|
|
}
|