|
@@ -0,0 +1,55 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Http\Resources\API;
|
|
|
+
|
|
|
+use Illuminate\Http\Request;
|
|
|
+use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
+
|
|
|
+class TaskDetailResource extends JsonResource
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * Transform the resource into an array.
|
|
|
+ *
|
|
|
+ * @return array<string, mixed>
|
|
|
+ */
|
|
|
+ public function toArray(Request $request): array
|
|
|
+ {
|
|
|
+ return [
|
|
|
+ "id" => $this->id,
|
|
|
+ "name" => $this->name,
|
|
|
+ "project_id" => $this->project_id,
|
|
|
+ "project" => new ProjectSimpleResource($this->project),
|
|
|
+ "requirement_id" => $this->requirement_id,
|
|
|
+ "requirement" => new RequirementSimpleResource($this->requirement),
|
|
|
+ "naming_rule_id" => $this->naming_rule_id,
|
|
|
+ "naming_rule" => new NamingRuleSimpleResource($this->namingRule),
|
|
|
+ "parent_id" => $this->parent_id,
|
|
|
+ "task_type" => $this->task_type,
|
|
|
+ "doc_stage" => $this->doc_stage,
|
|
|
+ "doc_type" => $this->doc_type,
|
|
|
+ "status" => $this->status,
|
|
|
+ "assign" => $this->assign,
|
|
|
+ "description" => $this->description,
|
|
|
+ "begin" => $this->begin,
|
|
|
+ "end" => $this->end,
|
|
|
+ "mailto" => $this->mailto,
|
|
|
+ "email_subject" => $this->email_subject,
|
|
|
+ "acl" => $this->acl,
|
|
|
+ "whitelist" => $this->whitelist,
|
|
|
+ "closed_by" => new UserProfileResource($this->closedBy),
|
|
|
+ "closed_at" => $this->closed_at,
|
|
|
+ "canceled_by" => new UserProfileResource($this->canceledBy),
|
|
|
+ "canceled_at" => $this->canceled_at,
|
|
|
+ "approve_by" => new UserProfileResource($this->approveBy),
|
|
|
+ "approve_at" => $this->approve_at,
|
|
|
+ "finished_by" => new UserProfileResource($this->finishedBy),
|
|
|
+ "finished_at" => $this->finished_at,
|
|
|
+ "review_by" => new UserProfileResource($this->reviewBy),
|
|
|
+ "review_at" => $this->review_at,
|
|
|
+ "created_by" => new UserProfileResource($this->createdBy),
|
|
|
+ "custom_fields" => $this->custom_fields,
|
|
|
+ "created_at" => (string)$this->created_at,
|
|
|
+ "updated_at" => (string)$this->updated_at
|
|
|
+ ];
|
|
|
+ }
|
|
|
+}
|