behaviors/LocationModel.php
public function setStateCodeAttribute($code)
    {
        if (!$state = State::whereCode($code)->first()) {
            return;
        }

        $this->model->state = $state;
    }
public function setStateCodeAttribute($code)
    {
        if (!$state = State::whereCode($code)->first()) {
            return;
        }

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