I have two staff tables with id , name and attendance columns. staff_id used as a foreign key in the attendance table.
I want to display the employee name in gridview for visits.
Attendance Model :
public function getStaff() { return $this->hasOne(Staff::className(), ['id' => 'staff_id']); } public function getStaffName() { return $this->staff->name; }
and in index.php i used this code
<?= GridView::widget([ [ 'attribute'=>'staff_id', 'value'=>'StaffName', ], ]); ?>
to get the value of the name of the staff. Thus, I get the employee name successfully, but the problem is that when I do a personnel name search in gridview, it says that "staff_id" should be integer, as I define it as an integer, but here I want to search for the personnel name instead id
How is this possible? thanks in advance
source share