countrycode.$this->areacode.$this->last; } else { $number = $this->countrycode.$this->areacode.$this->first; } return $number; } public function getProperty($name) { if($this->$name == null) { if($name == "files") { $this->files = VoiceblocknumberFileModel::search(["voicenumberblock_id" => $this->id]); return $this->files; } if($name == "numbers") { $this->numbers = VoicenumberModel::search(["voicenumberblock_id" => $this->id]); return $this->numbers; } if($name == "number_first") { return $this->getFullNumber(); } if($name == "number_last") { return $this->getFullNumber(true); } $classname = ucfirst($name); $idfield = $name."_id"; $this->$name = new $classname($this->$idfield); if($this->$name->id) { return $this->$name; } else { return null; } } return $this->$name; } }