behaviors/LocationModel.php
public function setCountryCodeAttribute($code)
    {
        if (!$country = Country::whereCode($code)->first()) {
            return;
        }

        $this->model->country = $country;
    }
public function setCountryCodeAttribute($code)
    {
        if (!$country = Country::whereCode($code)->first()) {
            return;
        }

        $this->model->country = $country;
    }
public function setCountryCodeAttribute ( $ code ) { if ( ! $ country = Country :: whereCode ( $ code ) -> first ( ) ) { return ; } $ this -> model -> country = $ country ; }
Sets the "country" relation with the code specified, model lookup used.
@param string $code
Sets the country relation with the code specified model lookup used .