Show data of model 1 in model 2 through gridview and in view of model 2, the data and are related by means of foreign key 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' => [
    // or this
        'attribute' => 'relationblablabla',
        'value' => function ($model) {
            return $model->relationblabla->name;