Skip to content

Commit

Permalink
Add CountryEntry to Infolists
Browse files Browse the repository at this point in the history
  • Loading branch information
agencetwogether authored Sep 21, 2024
1 parent 58964b1 commit b260ad4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Infolists/CountryEntry.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Parfaitementweb\FilamentCountryField\Infolists;

use Filament\Infolists\Components\TextEntry;
use Parfaitementweb\FilamentCountryField\Tables\Columns\CountryColumn;
use Parfaitementweb\FilamentCountryField\Traits\HasData;

class CountryEntry extends TextEntry
{
use HasData;

public function nativeCountry()
{
$countries = $this->getCountriesList();
$state = $this->getState();

return $countries[$state] ?? $state;
}

protected function setUp(): void
{
parent::setUp();

$this->formatStateUsing(fn (): string => $this->nativeCountry());
}
}

0 comments on commit b260ad4

Please sign in to comment.