where("resource_id", $value); } } /** * 搜索器:体测学员姓名 * @param $value * @param $data */ public function searchStudentIdAttr($query, $value, $data) { if ($value) { $query->where("student_id", $value); } } public function customerResources(){ return $this->hasOne(CustomerResources::class, 'id', 'resource_id')->joinType('left')->withField('name,id')->bind(['resource_id_name'=>'name']); } public function student(){ return $this->hasOne(Student::class, 'id', 'student_id')->joinType('left')->withField('name,id')->bind(['student_id_name'=>'name']); } public function personnel(){ return $this->hasOne(Personnel::class, 'id', 'coach_id')->joinType('left')->withField('name,id')->bind(['coach_id_name'=>'name']); } }