ProviderWithdrawalResource.php 1.2 KB

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