LibraryResource.php 777 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Resources\API;
  3. use App\Models\Asset;
  4. use App\Models\Project;
  5. use Illuminate\Http\Request;
  6. use Illuminate\Http\Resources\Json\JsonResource;
  7. class LibraryResource extends JsonResource
  8. {
  9. /**
  10. * Transform the resource into an array.
  11. *
  12. * @return array<string, mixed>
  13. */
  14. public function toArray(Request $request): array
  15. {
  16. return [
  17. 'id' => $this->id,
  18. 'name' => $this->name,
  19. 'asset_id' => $this->asset_id,
  20. 'project_id' => $this->project_id,
  21. 'acl' => $this->acl,
  22. 'whitelist' => make_array_list($this->whitelist??''),
  23. 'created_at' => (string)$this->created_at,
  24. 'updated_at' => (string)$this->updated_at,
  25. ];
  26. }
  27. }