lifetime; } public function getKey($id = null) { return "course_teacher_list:{$id}"; } public function getContent($id = null) { $courseRepo = new CourseRepo(); $users = $courseRepo->findTeachers($id); if ($users->count() == 0) { return []; } return $this->handleContent($users); } /** * @param UserModel[] $users * @return array */ public function handleContent($users) { $result = []; foreach ($users as $user) { $result[] = [ 'id' => $user->id, 'name' => $user->name, 'avatar' => $user->avatar, 'title' => $user->title, 'about' => $user->about, ]; } return $result; } }