visuddhinanda 3 năm trước cách đây
mục cha
commit
42de7544ae
1 tập tin đã thay đổi với 17 bổ sung1 xóa
  1. 17 1
      app/Http/Resources/CourseResource.php

+ 17 - 1
app/Http/Resources/CourseResource.php

@@ -3,6 +3,7 @@
 namespace App\Http\Resources;
 
 use Illuminate\Http\Resources\Json\JsonResource;
+use App\Http\Api\UserApi;
 
 class CourseResource extends JsonResource
 {
@@ -14,6 +15,21 @@ class CourseResource extends JsonResource
      */
     public function toArray($request)
     {
-        return parent::toArray($request);
+        return [
+            "id"=>$this->id,
+            "title"=> $this->title,
+            "subtitle"=> $this->subtitle,
+            "teacher"=> UserApi::getById($this->teacher),
+            "course_count"=>10,
+            "type"=> 1,
+            "anthology_id"=> '',
+            "start_at"=> $this->start_at,
+            "end_at"=> $this->end_at,
+            "content"=> $this->content,
+            "content_type"=> $this->content_type,
+            "cover"=> $this->cover,
+            "created_at"=> $this->created_at,
+            "updated_at"=> $this->updated_at,
+        ];
     }
 }