32 lines
1.1 KiB
PHP
32 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Admin;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class WithdrawRequestResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'amount' => $this->amount,
|
|
'status' => $this->status,
|
|
'admin_note' => $this->admin_note,
|
|
'user' => $this->relationLoaded('user') ? $this->user->only(['id', 'fullname', 'level', 'phone']) : null,
|
|
'bank_card' => $this->relationLoaded('bankCard') && $this->bankCard
|
|
? $this->bankCard->only(['id', 'card_number', 'holder_name'])
|
|
: null,
|
|
'reviewed_by' => $this->relationLoaded('reviewedBy') && $this->reviewedBy ? $this->reviewedBy->only(['id', 'fullname']) : null,
|
|
'created_at' => verta($this->created_at)->format('%Y/%m/%d - H:i'),
|
|
'reviewed_at' => $this->reviewed_at ? verta($this->reviewed_at)->format('%Y/%m/%d - H:i') : null,
|
|
];
|
|
}
|
|
}
|