Browse Source

调整项目公共查询返回数据

kely 5 months ago
parent
commit
b6ebae60a3
1 changed files with 7 additions and 0 deletions
  1. 7 0
      app/Http/Resources/API/ProjectSimpleResource.php

+ 7 - 0
app/Http/Resources/API/ProjectSimpleResource.php

@@ -18,6 +18,13 @@ class ProjectSimpleResource extends JsonResource
             'id' => $this->id,
             'name' => $this->name,
             'display_id'=>$this->display_id,
+            'begin' => $this->begin,
+            'end' => $this->end,
+            'asset'=> $this->when($this->assets->isNotEmpty(),function (){
+                return $this->assets->map(function ($asset){
+                    return new SimpleAssetResource($asset);
+                })->all();
+            }),
         ];
     }
 }