<?php namespace App\Http\Resources\API; use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; class PlanByAssetResource extends JsonResource { /** * Transform the resource into an array. * * @return array<string, mixed> */ public function toArray(Request $request): array { return [ 'id' => $this->id, 'title' => $this->title, 'asset_id' => $this->asset_id, 'asset_name' => $this->asset ? $this->asset->name : null, ]; } }