HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/Eurotools/euro-tools.nl/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);
    }
}