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/SBogers85/equichecker.com/app/KommaApp/Countries/CountryRepository.php
<?php

namespace KommaApp\Countries;

use KommaApp\Kms\Core\KmsSiteRepository;
use KommaApp\Countries\Models\Country;

class CountryRepository extends KmsSiteRepository
{
    /**
     * @var Country
     */
    protected $countryModel;

    function __construct(Country $countryModel)
    {
        $this->countryModel = $countryModel;
    }


    public function allCountries()
    {
        return \DB::table('countries')
            ->select('iso_2')
            ->get();
    }

    public function siteCountry()
    {
        return \DB::table('countries')
            ->join('sites', 'sites.country_id', '=', 'countries.id')
            ->select('countries.iso_2')
            ->where('sites.id', \Site::getId() )
            ->first();
    }

    public function getCountryByIso2($iso2)
    {
        return $this->countryModel
            ->where('iso_2', $iso2)
            ->first();
    }
}