ソースを参照

添加学员channel绑定信息

visuddhinanda 2 年 前
コミット
654a23e7cf
1 ファイル変更7 行追加0 行削除
  1. 7 0
      app/Http/Resources/CourseMemberResource.php

+ 7 - 0
app/Http/Resources/CourseMemberResource.php

@@ -4,6 +4,7 @@ namespace App\Http\Resources;
 
 use Illuminate\Http\Resources\Json\JsonResource;
 use App\Http\Api\UserApi;
+use App\Http\Api\ChannelApi;
 
 class CourseMemberResource extends JsonResource
 {
@@ -27,6 +28,12 @@ class CourseMemberResource extends JsonResource
             "created_at"=> $this->created_at,
             "updated_at"=> $this->updated_at,
         ];
+        if($this->channel_id){
+            $channel = ChannelApi::getById($this->channel_id);
+            if($channel){
+               $data['channel'] =  $channel;
+            }
+        }
         return $data;
     }
 }