26 lines
774 B
PHP
26 lines
774 B
PHP
<?php
|
|
|
|
namespace Modules\User\Transformers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use Modules\User\Transformers\BankResource;
|
|
|
|
class BankDetailResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'user_id' => $this->user_id,
|
|
'bank_id' => $this->bank_id,
|
|
'account_number' => $this->account_number,
|
|
'account_name' => $this->account_name,
|
|
'account_type' => $this->account_type,
|
|
'bank' => new BankResource($this->whenLoaded('bank')),
|
|
'created_at' => $this->created_at?->toISOString(),
|
|
'updated_at' => $this->updated_at?->toISOString(),
|
|
];
|
|
}
|
|
}
|