ProviderWithdrawalResource.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
  5. use Illuminate\Http\Resources\Json\JsonResource;
  6. class ProviderWithdrawalResource extends JsonResource
  7. {
  8. public function toArray(Request $request): array
  9. {
  10. return [
  11. 'id' => $this->id,
  12. 'provider_id' => $this->provider_id,
  13. 'recipient_id' => $this->recipient_id,
  14. 'transfer_id' => $this->transfer_id,
  15. 'gross_amount' => $this->gross_amount,
  16. 'gateway_fee_amount' => $this->gateway_fee_amount,
  17. 'net_amount' => $this->net_amount,
  18. 'status' => $this->status,
  19. 'type' => $this->type,
  20. 'bank_account' => $this->bank_account,
  21. 'completed_at' => $this->completed_at?->toISOString(),
  22. 'failed_at' => $this->failed_at?->toISOString(),
  23. 'created_at' => $this->created_at?->toISOString(),
  24. ];
  25. }
  26. public static function collection($resource): AnonymousResourceCollection
  27. {
  28. return parent::collection($resource);
  29. }
  30. }