WebHookResource.php 908 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Contracts\Support\Arrayable;
  4. use Illuminate\Http\Request;
  5. use Illuminate\Http\Resources\Json\JsonResource;
  6. class WebHookResource extends JsonResource
  7. {
  8. /**
  9. * Transform the resource into an array.
  10. *
  11. * @param Request $request
  12. * @return array|Arrayable|\JsonSerializable
  13. */
  14. public function toArray($request)
  15. {
  16. $data = [
  17. 'id' => $this->id,
  18. 'res_type' => $this->res_type,
  19. 'res_id' => $this->res_id,
  20. 'url' => $this->url,
  21. 'receiver' => $this->receiver,
  22. 'event' => json_decode($this->event),
  23. 'status' => $this->status,
  24. 'fail' => $this->fail,
  25. 'success' => $this->success,
  26. 'created_at' => $this->created_at,
  27. 'updated_at' => $this->updated_at,
  28. ];
  29. return $data;
  30. }
  31. }