pai = $pai; $this->filho = $filho; $this->indice = $indice; parent::__construct(); } public function render() { $msg = ($this->pai && $this->filho) ? "Local anatômico '{$this->pai}' não corresponde ao local anatômico região '{$this->filho}'." : 'Local anatômico informado não corresponde ao local anatômico região.'; if ($this->indice !== null) { $msg = "Ferida [{$this->indice}]: {$msg}"; } return response()->json([ 'message' => $msg ], Response::HTTP_UNPROCESSABLE_ENTITY); } }