相反,如果$ model-> id,如何将其更改为$ model-> city_name?
$this->params['breadcrumbs'][] = ['label' => $model->cluster, 'url' => ['view', 'id' => $model->id]];
这是关系
public function getCityName()
{
return $this->hasOne(LibCities::className(),['city_code'=>'city_code']);
}
这是我的tbl_targetcities
这是我的lib_cities表
示例视图..将表格lib_cities中的ID从tbl_target_Cities更改为CITY_NAME。
答案 0 :(得分:4)
将$model->id
属性$model->cityName->city_name
更改为label
:
$this->params['breadcrumbs'][] = ['label' => $model->cityName->city_name, 'url' => ['view', 'id' => $model->id]];