<?php

namespace Modules\Internal\Transformers;

use Illuminate\Http\Resources\Json\JsonResource;

class ClaimResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request
     * @return array
     */
    public function toArray($request)
    {
        $claimData = parent::toArray($request);
        $claimData['uploaded_files'] = $this->files->groupBy('type');

        return $claimData;
    }
}
