You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

2 years ago
2 years ago
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class FileResource extends JsonResource
  5. {
  6. /**
  7. * Transform the resource into an array.
  8. *
  9. * @param \Illuminate\Http\Request $request
  10. * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
  11. */
  12. public function toArray($request)
  13. {
  14. return [
  15. "uuid" => $this->uuid,
  16. "original_name" => $this->original_name,
  17. "ext" => $this->ext,
  18. "mimetype" => $this->mimetype,
  19. "width" => $this->width,
  20. "height" => $this->height,
  21. "file_size" => $this->file_size,
  22. "sort" => $this->sort,
  23. "alts" => $this->alts,
  24. "description" => $this->description,
  25. "user_id" => $this->user_id,
  26. "ip" => $this->ip,
  27. "collection_id" => $this->collection_id,
  28. "published_at" => $this->published_at,
  29. "created_at" => $this->created_at,
  30. "updated_at" => $this->updated_at,
  31. "deleted_at" => $this->deleted_at,
  32. ];
  33. }
  34. }