JsonSerializableResource.php 388 B

12345678910111213141516171819202122
  1. <?php
  2. namespace Illuminate\Tests\Integration\Http\Fixtures;
  3. use JsonSerializable;
  4. class JsonSerializableResource implements JsonSerializable
  5. {
  6. public $resource;
  7. public function __construct($resource)
  8. {
  9. $this->resource = $resource;
  10. }
  11. public function jsonSerialize(): array
  12. {
  13. return [
  14. 'id' => $this->resource->id,
  15. ];
  16. }
  17. }