Хочу вывести сумму, студента, который сделал оплату, в просмотре студента?
Поле f_student_id в таблице ge_pay имеет вшений ключ к таблице ge_students
Связь таблиц
4278
Модель Students.php
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'fPays' => array(self::HAS_MANY, 'Pay', 'pay_id'),
);
}
View.php
<div class="tab-pane" id="tab-finance">
<legend>Финансы</legend>
<?php $this->widget('bootstrap.widgets.TbGridView',array(
'dataProvider'=>$model->search(),
'type'=>'striped bordered condensed',
'template'=>'{summary}{pager}{items}{pager}',
'filter'=>$model,
'columns'=>array(
array(
//курс
'name' => 'f_course_id',
'value' => '$data->fPays->course_name' ,
'filter' => '',
),
//сумма
array(
'name' => 'sum',
'value' => '$data->fPays->sum',
'filter' => '',
),
),
)); ?>
</div>
Вывод
4279