good day
I am a newbie in yii2 and I need to know how to show the data of a model 1 in the view and in the gridview of a model 2 to generate a pdf with the necessary information for that model2, the information is already stored in the database
good day
I am a newbie in yii2 and I need to know how to show the data of a model 1 in the view and in the gridview of a model 2 to generate a pdf with the necessary information for that model2, the information is already stored in the database
you can directly do this, this apply for both , gridview and view (list view)
where relationblabla , is the name of your relationship on model
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id',
'relationblabla.name',
'relationblabla.data,
// or this
[
'attribute' => 'relationblablabla',
'value' => function ($model) {
return $model->relationblabla->name;
},
],
],