. */ declare(strict_types=1); namespace FireflyIII\Transformers; use FireflyIII\Models\Attachment; use League\Fractal\TransformerAbstract; /** * Class AttachmentTransformer */ class AttachmentTransformer extends TransformerAbstract { /** * @param Attachment $attachment * * @return array */ public function transform(Attachment $attachment): array { return [ 'id' => (int)$attachment->id, 'attachable_type' => $attachment->attachable_type, 'md5' => $attachment->md5, 'filename' => $attachment->filename, 'title' => $attachment->title, 'description' => $attachment->description, 'notes' => $attachment->notes, 'mime' => $attachment->mime, 'size' => $attachment->size, 'links' => [ [ 'rel' => 'self', 'uri' => '/attachment/' . $attachment->id, ], ] ]; } }