'integer', 'miniapp_user_id' => 'integer', 'source_dict_item_id' => 'integer', 'star_level_dict_item_id' => 'integer', 'status_dict_item_id' => 'integer', 'next_follow_date' => 'date', 'is_partner' => 'boolean', 'converted_at' => 'datetime', 'sort' => 'integer', ]; public function university(): BelongsTo { return $this->belongsTo(University::class); } /** 列表/详情展示用:优先高校库名称,否则抓取原文 */ public function displayUniversityName(): ?string { $linked = $this->university?->name; if ($linked !== null && $linked !== '') { return $linked; } $text = trim((string) ($this->university_text ?? '')); return $text !== '' ? $text : null; } public function miniappUser(): BelongsTo { return $this->belongsTo(MiniappUser::class); } public function sourceItem(): BelongsTo { return $this->belongsTo(DictItem::class, 'source_dict_item_id'); } public function starLevelItem(): BelongsTo { return $this->belongsTo(DictItem::class, 'star_level_dict_item_id'); } public function statusItem(): BelongsTo { return $this->belongsTo(DictItem::class, 'status_dict_item_id'); } public function followRecords(): HasMany { return $this->hasMany(TeacherFollowRecord::class)->orderByDesc('followed_at')->orderByDesc('id'); } public function researchDirections(): BelongsToMany { return $this->belongsToMany( ResearchDirection::class, 'teacher_research_direction', 'teacher_id', 'research_direction_id' )->orderBy('research_directions.sort')->orderBy('research_directions.name'); } public function papers(): BelongsToMany { return $this->belongsToMany(Paper::class, 'teacher_papers')->withTimestamps(); } public function demands(): HasMany { return $this->hasMany(Demand::class); } }