Answer the question
In order to leave comments, you need to log in
Yii2 Display related data in admin?
Hello.
I am using advanced template. There is related data. In the form (_form.php) when adding, I use this code to display not id, but normal data.
<?= $form->field($model, 'team_id')->label('Сборная')->dropDownList(
ArrayHelper::map(Team::find()->all(), 'id_team', 'team'),
['prompt' => 'Выберите игрока']
); ?>
Answer the question
In order to leave comments, you need to log in
Try, for example, this extension: https://github.com/kartik-v/yii2-widget-select2
It is
very convenient to work with related data.
1. Your code is not a link. The relationship is described in the model and has hasOne or hasMany
2.
But when you look at all the informationWhere are you browsing? What is the information provided with?
чтобы вместо ID появлялась текстовая информация
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question