src/Models/Database/Address.php
public function getCountryIdAttribute()
    {
        if (isset($this->attributes['country_id']) && $this->attributes['country_id'] > 0) {
            return $this->attributes['country_id'];
        }

        $configRepository = app(ConfigurationInterface::class);
        $defaultCountry = $configRepository->getValueByKey('user_default_country');

        if (isset($defaultCountry)) {
            return $defaultCountry;
        }

        return null;
    }
public function getCountryIdAttribute()
    {
        if (isset($this->attributes['country_id']) && $this->attributes['country_id'] > 0) {
            return $this->attributes['country_id'];
        }

        $configRepository = app(ConfigurationInterface::class);
        $defaultCountry = $configRepository->getValueByKey('user_default_country');

        if (isset($defaultCountry)) {
            return $defaultCountry;
        }

        return null;
    }
public function getCountryIdAttribute ( ) { if ( isset ( $ this -> attributes [ 'country_id' ] ) && $ this -> attributes [ 'country_id' ] > 0 ) { return $ this -> attributes [ 'country_id' ] ; } $ configRepository = app ( ConfigurationInterface :: class ) ; $ defaultCountry = $ configRepository -> getValueByKey ( 'user_default_country' ) ; if ( isset ( $ defaultCountry ) ) { return $ defaultCountry ; } return null ; }
To Check If Country Id is Null then it Returns Default Country ID from Configuration

@return int|null $countryId
To Check If Country Id is Null then it Returns Default Country ID from Configuration