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/topswtw.komma.pro/app/KommaApp/Shop/Countries/CountryRepository.php
<?php

namespace KommaApp\Shop\Countries;

use KommaApp\Shop\Countries\Models\Country;

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

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


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

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

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