File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1111/**
1212 * @property-read \Moox\Data\Models\StaticLanguage|null $language
1313 * @property-read \Moox\Data\Models\StaticCountry|null $country
14+ * @property string $flag_country_code
1415 */
1516class StaticLocale extends Model
1617{
@@ -41,6 +42,10 @@ public function country()
4142
4243 public function getLanguageFlagIconAttribute (): ?string
4344 {
45+ if (! $ this ->flag_country_code ) {
46+ return null ;
47+ }
48+
4449 return match ($ this ->language ?->alpha2) {
4550 'ar ' => 'flag-ar_arab ' ,
4651 default => 'flag- ' .strtolower ($ this ->flag_country_code ),
@@ -49,6 +54,10 @@ public function getLanguageFlagIconAttribute(): ?string
4954
5055 public function getCountryFlagIconAttribute (): ?string
5156 {
52- return 'flag- ' .strtolower ($ this ->country ?->alpha2);
57+ if (! $ this ->country ?->alpha2) {
58+ return null ;
59+ }
60+
61+ return 'flag- ' .strtolower ($ this ->country ->alpha2 );
5362 }
5463}
You can’t perform that action at this time.
0 commit comments