2018-02-13 00:51:04 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Support;
|
|
|
|
|
2019-04-08 07:09:29 +08:00
|
|
|
use League\ISO3166\ISO3166;
|
|
|
|
|
2018-02-13 00:51:04 +08:00
|
|
|
/**
|
|
|
|
* Class Countries
|
|
|
|
*/
|
|
|
|
class Countries
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Get a select box list of all the countries
|
2018-08-27 00:40:04 +08:00
|
|
|
*
|
2018-02-13 00:51:04 +08:00
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public static function getSelectList()
|
|
|
|
{
|
2019-04-08 07:09:29 +08:00
|
|
|
$countries = collect((new ISO3166())->all())
|
|
|
|
->mapWithKeys(static function ($item, $key) {
|
2018-02-13 00:51:04 +08:00
|
|
|
return [strtolower($item['alpha2']) => $item['name']];
|
|
|
|
});
|
|
|
|
|
|
|
|
return $countries;
|
|
|
|
}
|
|
|
|
}
|