'array' ]; /** * Get the translated name. * * @return string */ public function getNameAttribute() { $names = $this->countries_name; if (is_array($names)) { $locale = \Kernel\Translator::getLocale() ?: 'pt_BR'; return $names[$locale] ?? $names['pt_BR'] ?? array_shift($names); } return $names; } /** * Get the states for the country. */ public function states() { return $this->hasMany(State::class, 'states_country_id', 'countries_id'); } }