$this->id, "title"=> $this->title, "subtitle"=> $this->subtitle, "teacher"=> UserApi::getById($this->teacher), "course_count"=>10, "member_count"=>CourseMember::where('course_id',$this->id)->count(), "publicity"=> $this->publicity, "start_at"=> $this->start_at, "end_at"=> $this->end_at, "content"=> $this->content, "content_type"=> $this->content_type, "cover"=> $this->cover, "channel_id"=>$this->channel_id, "created_at"=> $this->created_at, "updated_at"=> $this->updated_at, ]; $textbook = Collection::where('uid',$this->anthology_id)->select(['uid','title','owner'])->first(); if($textbook){ $data['anthology_id'] = $textbook->uid; $data['anthology_title'] = $textbook->title; $data['anthology_owner'] = StudioApi::getById($textbook->owner); } if(!empty($this->channel_id)){ $channel = Channel::where('uid',$this->channel_id)->select(['name','owner_uid'])->first(); if($channel){ $data['channel_name'] = $channel->name; $data['channel_owner'] = StudioApi::getById($channel->owner_uid); } } return $data; } }