| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace App\Http\Resources;
- use Illuminate\Http\Request;
- use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
- use Illuminate\Http\Resources\Json\JsonResource;
- class ProviderWithdrawalResource extends JsonResource
- {
- public function toArray(Request $request): array
- {
- return [
- 'id' => $this->id,
- 'provider_id' => $this->provider_id,
- 'provider_name' => $this->provider?->user?->name,
- 'recipient_id' => $this->recipient_id,
- 'transfer_id' => $this->transfer_id,
- 'gross_amount' => $this->gross_amount,
- 'gateway_fee_amount' => $this->gateway_fee_amount,
- 'net_amount' => $this->net_amount,
- 'status' => $this->status,
- 'type' => $this->type,
- 'bank_account' => $this->bank_account,
- 'completed_at' => $this->completed_at?->toISOString(),
- 'failed_at' => $this->failed_at?->toISOString(),
- 'payment_split_ids' => $this->whenLoaded('paymentSplits', fn () => $this->paymentSplits->pluck('id')->values()),
- 'created_at' => $this->created_at?->toISOString(),
- ];
- }
- public static function collection($resource): AnonymousResourceCollection
- {
- return parent::collection($resource);
- }
- }
|