whenLoaded('simbrief')) { unset($res['subfleets']); $res['simbrief'] = new SimbriefResource($this->simbrief); } else { unset($res['simbrief']); $res['subfleets'] = Subfleet::collection($this->whenLoaded('subfleets')); } $res['fields'] = $this->setFields(); return $res; } }