<?php

declare(strict_types=1);

namespace App\Http\Resources;

use Illuminate\Http\Request;

class InvoiceDetailResource extends InvoiceResource
{
    public function toArray(Request $request): array
    {
        return array_merge(parent::toArray($request), [
            'items' => InvoiceItemResource::collection($this->whenLoaded('items')),
        ]);
    }
}
