瀏覽代碼

add fork_from pr_from

visuddhinanda 2 年之前
父節點
當前提交
609f6e2c0e
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      app/Http/Resources/SentHistoryResource.php

+ 11 - 0
app/Http/Resources/SentHistoryResource.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 SentHistoryResource extends JsonResource
 {
@@ -21,8 +22,18 @@ class SentHistoryResource extends JsonResource
             "editor" => UserApi::getByUuId($this->user_uid),
             'content' => $this->content,
             'landmark' => $this->landmark,
+            'pr_from' => $this->pr_from,
             'created_at' => $this->created_at
         ];
+        if($this->fork_from){
+            $fork_from = ChannelApi::getById($this->fork_from);
+            if($fork_from){
+                $data['fork_from'] = $fork_from;
+            }
+        }
+        if($this->accepter_uid){
+            $data['accepter'] = UserApi::getByUuId($this->accepter_uid);
+        }
         return $data;
     }
 }