Exemplo n.º 1
0
 public function testCountries()
 {
     $this->assertGreaterThan(220, count(\Addresses::getCountries()));
     // should be like 240 or so
     $this->assertEquals(Country::byCode('US')->first(), Country::byCode('USA')->first());
     $this->assertEquals('Canada', \Addresses::countryName('CA'));
 }
 public function run()
 {
     DB::table('countries')->truncate();
     Country::insert($this->insertList);
 }
Exemplo n.º 3
0
 /**
  * Accept 2 or 3 digit alpha-code
  *
  * @param string $countryA2
  * @return $string full country name
  */
 public static function countryName($countryA2)
 {
     if (strlen($countryA2) != 2) {
         throw new InvalidValueException();
     }
     return Cache::rememberForever('addresses.' . $countryA2 . '.country_name', function () use($countryA2) {
         return Country::byCode($countryA2)->first()->name;
     });
 }