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/SBogers10/stempel.komma.pro/app/Komma/Globalization/Countries/CountryService.php
<?php


namespace App\Komma\Globalization\Countries;


use App\Komma\Globalization\Countries\Models\Country;

class CountryService
{

    public function countriesForCheckout()
    {
        // Get all countries
        $countries = Country::all();

        // 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 getCountryByIso2($iso_2) : Country
    {
        return $country = Country::where('iso_2', $iso_2)
            ->first();
    }
}