2
0

WebHookResource.php 869 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class WebHookResource 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. $data = [
  15. "id"=>$this->id,
  16. "res_type"=> $this->res_type,
  17. "res_id"=> $this->res_id,
  18. "url"=> $this->url,
  19. "receiver"=> $this->receiver,
  20. "event"=> json_decode($this->event),
  21. "status"=> $this->status,
  22. "fail"=> $this->fail,
  23. "success"=> $this->success,
  24. "created_at"=> $this->created_at,
  25. "updated_at"=> $this->updated_at,
  26. ];
  27. return $data;
  28. }
  29. }