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