|
@@ -0,0 +1,32 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Http\Resources\API;
|
|
|
+
|
|
|
+use Illuminate\Http\Request;
|
|
|
+use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
+
|
|
|
+class ContainerResource extends JsonResource
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * Transform the resource into an array.
|
|
|
+ *
|
|
|
+ * @return array<string, mixed>
|
|
|
+ */
|
|
|
+ public function toArray(Request $request): array
|
|
|
+ {
|
|
|
+ $content = $this->content($request->get("version", 0))->first();
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'id' => $this->id,
|
|
|
+ 'name' => $content?->name,
|
|
|
+ 'library' => new LibrarySimpleResource($this->library),
|
|
|
+ 'naming_rule' => new NamingRuleSimpleResource($this->namingRule),
|
|
|
+ 'naming_rules' => $this->naming_rules,
|
|
|
+ "doc_stage" => $this->doc_stage,
|
|
|
+ "doc_type" => $this->doc_type,
|
|
|
+ "version" => $this->version,
|
|
|
+ "created_at" => (string)$this->created_at,
|
|
|
+ "created_by" => new UserProfileResource($this->createdBy),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+}
|