Files
water-back/modules/User/Http/Resources/Account/UserAccountLogResource.php
2023-01-12 14:47:38 +08:00

31 lines
983 B
PHP

<?php
namespace Modules\User\Http\Resources\Account;
use Illuminate\Http\Resources\Json\JsonResource;
class UserAccountLogResource extends JsonResource
{
public function toArray($request): array
{
return [
'user_account_log_id' => $this->id,
'frozen' => [
'value' => $this->frozen,
'text' => $this->frozen ? '待发放' : '已发放',
],
'rule' => [
'rule_id' => $this->rule->id,
'name' => $this->rule->name,
'title' => $this->rule->title,
'remark' => $this->rule->remark,
],
'remark' => $this->source['remark'] ?? $this->rule->remark,
'amount' => $this->amount > 0 ? '+'.floatval($this->amount) : floatval($this->amount),
'created_at' => $this->created_at->format('Y-m-d H:i:s'),
];
}
}