¨4.0.1¨
This commit is contained in:
@@ -25,6 +25,18 @@ class Country
|
||||
*/
|
||||
private static $supported;
|
||||
|
||||
|
||||
/**
|
||||
* Get all country codes.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function codes()
|
||||
{
|
||||
return array_keys(self::all());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all countries.
|
||||
*
|
||||
@@ -39,33 +51,6 @@ class Country
|
||||
return self::$countries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all supported countries.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function supported()
|
||||
{
|
||||
if (! is_null(self::$supported)) {
|
||||
return self::$supported;
|
||||
}
|
||||
|
||||
$supportedCountries = setting('supported_countries');
|
||||
|
||||
return self::$supported = array_filter(static::all(), function ($code) use ($supportedCountries) {
|
||||
return in_array($code, $supportedCountries);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all country codes.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function codes()
|
||||
{
|
||||
return array_keys(self::all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get supported country codes.
|
||||
@@ -77,10 +62,31 @@ class Country
|
||||
return array_keys(self::supported());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all supported countries.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function supported()
|
||||
{
|
||||
if (!is_null(self::$supported)) {
|
||||
return self::$supported;
|
||||
}
|
||||
|
||||
$supportedCountries = setting('supported_countries');
|
||||
|
||||
return self::$supported = array_filter(static::all(), function ($code) use ($supportedCountries) {
|
||||
return in_array($code, $supportedCountries);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get name of the given country code.
|
||||
*
|
||||
* @param string $code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function name($code)
|
||||
|
||||
Reference in New Issue
Block a user