<?php

namespace Modules\Cms\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class CategoryResource extends JsonResource
{

    public function toArray($request): array
    {
        return [
            'category_id' => $this->id,
            'parent'      => new self($this->parent),
            'title'       => $this->title,
            'slug'        => $this->slug,
            'description' => $this->description,
            'cover'       => $this->cover_url,
            'pictures'    => $this->pictures_url,
            'content'     => $this->content,
            'created_at'  => (string) $this->created_at,
        ];
    }

}