user(); $payload = MiniappPresenter::userPayload($user); if (! ($payload['can_see_radar'] ?? false)) { return $this->fail('无权查看老师详情', 403); } $model = Teacher::query() ->with(['university', 'researchDirections', 'starLevelItem', 'statusItem']) ->findOrFail($teacher); return $this->ok([ 'id' => $model->id, 'name' => $model->name, 'department' => $model->department, 'bio' => $model->bio, 'title' => $model->title, 'city' => $model->city, 'phone' => $model->phone, 'email' => $model->email, 'university_name' => $model->displayUniversityName(), 'research_direction' => $model->researchDirections->pluck('name')->join('、') ?: null, 'research_directions' => $model->researchDirections->map(fn ($d) => [ 'id' => $d->id, 'name' => $d->name, ])->values()->all(), 'star_level_item' => $model->starLevelItem ? [ 'id' => $model->starLevelItem->id, 'label' => $model->starLevelItem->label, 'value' => $model->starLevelItem->value, ] : null, 'status_item' => $model->statusItem ? [ 'id' => $model->statusItem->id, 'label' => $model->statusItem->label, 'value' => $model->statusItem->value, ] : null, 'is_partner' => (bool) $model->is_partner, ]); } }