title: How to retrieve data from relation model in yii2
body: <p>Instead if $model->id, how to change it to $model->city_name?    </p>
  
  <pre><code>$this-&gt;params['breadcrumbs'][] = ['label' =&gt; $model-&gt;cluster, 'url' =&gt; ['view', 'id' =&gt; $model-&gt;id]]; 
  </code></pre>
  
  <p>Here is the relation</p>
  
  <pre><code>public function getCityName()
  {
    return $this-&gt;hasOne(LibCities::className(),['city_code'=&gt;'city_code']);
  }
  </code></pre>
  
  <p>This is my tbl_targetcities
  <img src="https://i.stack.imgur.com/FJqKj.png" alt="enter image description here"></p>
  
  <p>and this is my lib_cities table
  <img src="https://i.stack.imgur.com/e2yLR.png" alt="enter image description here"></p>
  
  <p>Sample View.. Change the 2 which is the ID from tbl_target_Cities to CITY_NAME from table lib_cities.
  <img src="https://i.stack.imgur.com/PdiOe.png" alt="enter image description here"></p>