Browse Source

添加学员channel绑定信息

visuddhinanda 2 years ago
parent
commit
654a23e7cf
1 changed files with 7 additions and 0 deletions
  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 Illuminate\Http\Resources\Json\JsonResource;
 use App\Http\Api\UserApi;
 use App\Http\Api\UserApi;
+use App\Http\Api\ChannelApi;
 
 
 class CourseMemberResource extends JsonResource
 class CourseMemberResource extends JsonResource
 {
 {
@@ -27,6 +28,12 @@ class CourseMemberResource extends JsonResource
             "created_at"=> $this->created_at,
             "created_at"=> $this->created_at,
             "updated_at"=> $this->updated_at,
             "updated_at"=> $this->updated_at,
         ];
         ];
+        if($this->channel_id){
+            $channel = ChannelApi::getById($this->channel_id);
+            if($channel){
+               $data['channel'] =  $channel;
+            }
+        }
         return $data;
         return $data;
     }
     }
 }
 }