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();
}
}