File: D:/HostingSpaces/SBogers10/douven.komma.pro/app/KommaApp/Countries/CountryService.php
<?php
namespace App\KommaApp\Countries;
use App\KommaApp\Site\Site;
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)
{
if(\Lang::has('countries.' . $country->iso_2))
{
$checkoutCountries[$country->iso_2] = \Lang::get('countries.' . $country->iso_2);
}
}
asort($checkoutCountries);
return $checkoutCountries;
}
public function siteCountry()
{
return $this->countryRepository->siteCountry();
}
public function siteCountryIso2()
{
return $this->countryRepository->siteCountry()->iso_2;
}
public function getCountryByIso2($iso2)
{
return $this->countryRepository->getCountryByIso2($iso2);
}
}