123456789101112131415161718192021222324252627282930313233 |
- <?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,
- 'approval_status' => $this->approval_status,
- "created_at" => (string)$this->created_at,
- "created_by" => new UserProfileResource($this->createdBy),
- ];
- }
- }
|