ContainerReportResource.php 739 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Created by IntelliJ IDEA.
  4. * User: kelyliang
  5. * Date: 2024/6/11
  6. * Time: 下午 03:38
  7. */
  8. namespace App\Http\Resources\API;
  9. use Illuminate\Http\Request;
  10. use Illuminate\Http\Resources\Json\JsonResource;
  11. class ContainerReportResource extends JsonResource
  12. {
  13. private static $index = 1;
  14. public function toArray(Request $request): array
  15. {
  16. $displayId = self::$index++;
  17. return [
  18. 'id' => $this->id,
  19. 'name' => $this->name,
  20. 'type'=>'container',
  21. 'menus_type'=>$this->library->type,
  22. 'created_at' => (string)$this->created_at,
  23. 'updated_at' => (string)$this->updated_at,
  24. 'display_id'=>(string)$displayId,
  25. ];
  26. }
  27. }