ApprovalFlowDetailResource.php 895 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Resources\API;
  3. use App\Models\User;
  4. use Illuminate\Http\Request;
  5. use Illuminate\Http\Resources\Json\JsonResource;
  6. class ApprovalFlowDetailResource extends JsonResource
  7. {
  8. /**
  9. * Transform the resource into an array.
  10. *
  11. * @return array<string, mixed>
  12. */
  13. public function toArray(Request $request): array
  14. {
  15. return [
  16. "id" => $this->id,
  17. "name" => $this->name,
  18. "type" => $this->type,
  19. "object_type" => $this->object_type,
  20. "object_id" => $this->object_id==0?null:$this->object_id,
  21. "nodes" => json_decode($this->nodes_config),
  22. "status" => $this->status,
  23. "created_by" => new UserProfileResource($this->createdBy),
  24. "created_at" => (string)$this->created_at,
  25. "updated_at" => (string)$this->updated_at,
  26. ];
  27. }
  28. }