fetchesCurrency = $fetchesCurrency; } public function execute(SegmentConstant $constant){ if($constant->reference === SegmentConstants::SUPPLIER_CURRENCIES) { return property_exists($constant->detail, 'id') ? new CurrencyResource($this->fetchesCurrency->execute(['id' => $constant->detail->id])) : ''; } return $constant->detail; } }