diff --git a/src/Infolists/PhoneEntry.php b/src/Infolists/PhoneEntry.php index 5f9d862..5e7bda1 100644 --- a/src/Infolists/PhoneEntry.php +++ b/src/Infolists/PhoneEntry.php @@ -46,13 +46,13 @@ public function displayFormat(PhoneInputNumberType $format) $format = $format->toLibPhoneNumberFormat(); - if ($format === PhoneNumberFormat::RFC3966) { - $formatted = phone( - number: $state, - country: $country, - format: $format - ); + $formatted = phone( + number: $state, + country: $country, + format: $format + ); + if ($format === PhoneNumberFormat::RFC3966) { $national = phone( number: $state, country: $country, @@ -60,19 +60,19 @@ public function displayFormat(PhoneInputNumberType $format) ); $html = << + $national HTML; - - return new HtmlString($html); + } else { + $html = << + $formatted + + HTML; } - return phone( - number: $state, - country: $country, - format: $format - ); + return new HtmlString($html); } catch (NumberParseException $e) { return $state; } diff --git a/src/Tables/PhoneColumn.php b/src/Tables/PhoneColumn.php index fa5d1e2..1489e96 100644 --- a/src/Tables/PhoneColumn.php +++ b/src/Tables/PhoneColumn.php @@ -46,13 +46,13 @@ public function displayFormat(PhoneInputNumberType $format) $format = $format->toLibPhoneNumberFormat(); - if ($format === PhoneNumberFormat::RFC3966) { - $formatted = phone( - number: $state, - country: $country, - format: $format - ); + $formatted = phone( + number: $state, + country: $country, + format: $format + ); + if ($format === PhoneNumberFormat::RFC3966) { $national = phone( number: $state, country: $country, @@ -60,19 +60,22 @@ public function displayFormat(PhoneInputNumberType $format) ); $html = << + $national HTML; - return new HtmlString($html); + + } else { + $html = << + $formatted + + HTML; } - return phone( - number: $state, - country: $country, - format: $format - ); + + return new HtmlString($html); } catch (NumberParseException $e) { return $state; }