<?php

namespace Modules\News\Models\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class NewsResource extends JsonResource
{
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'image' => $this->image_url,
            'title' => optional($this->currentDescription)->title,
            'description' => optional($this->currentDescription)->description,
            'created_at' => $this->created_at,
        ];
    }
}
