6
0
Fork 0
jiqu-library-server/app/Endpoint/Api/Http/Resources/UserWalletResource.php

25 lines
702 B
PHP

<?php
namespace App\Endpoint\Api\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class UserWalletResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'balance'=> $this->resource?->balance_format ?: '0.00',
'withdrawable' => (bool) $this->resource?->withdrawable ?: true,
'is_frozen' => (bool) $this->resource?->is_frozen,
'has_password' => (bool) $this->resource?->password,
];
}
}