File: D:/HostingSpaces/SBogers10/topswtwmobile.komma.pro/app/KommaApp/Shop/Countries/CountryService.php
<?php
namespace KommaApp\Shop\Countries;
use KommaApp\Shop\Shop;
class CountryService
{
/**
* @var CountryRepository
*/
private $countryRepository;
/**
* @param CountryRepository $countryRepository
*/
public function __construct(CountryRepository $countryRepository)
{
$this->countryRepository = $countryRepository;
}
public function countriesForCheckout()
{
// Get all countries
$countries = $this->countryRepository->allCountries();
// Create array
$checkoutCountries = [];
foreach($countries as $country)
{
//temp disable switserland
if($country->iso_2 == 'CH') continue;
if(\Lang::has('countries.' . $country->iso_2))
{
$checkoutCountries[$country->iso_2] = \Lang::get('countries.' . $country->iso_2);
}
}
asort($checkoutCountries);
return $checkoutCountries;
}
public function shopCountry()
{
return $this->countryRepository->shopCountry();
}
public function shopCountryIso2()
{
return $this->countryRepository->shopCountry()->iso_2;
}
public function getCountryByIso2($iso2)
{
return $this->countryRepository->getCountryByIso2($iso2);
}
}