1234567891011121314151617181920212223242526272829 |
- <?php
- namespace App\Http\Resources;
- use App\Models\WalletLog;
- use Illuminate\Http\Resources\Json\JsonResource;
- class WalletResource extends JsonResource
- {
- /**
- * Transform the resource into an array.
- *
- * @param \Illuminate\Http\Request $request
- * @return array
- */
- public function toArray($request)
- {
- $model = $this->resource;
- return [
- 'created_at' => date('Y-m-d H:i:s',strtotime($model->created_at)),
- 'operate_type_status' => (bool)$model->operate_type,
- 'pay_type' => WalletLog::$typeMaps[$model->type], //支付方式
- 'operate_type' => WalletLog::$operateTypeMaps[$model->operate_type], //交易类型
- 'money' => $model->money,
- 'status' => (bool)$model->status,
- 'nickname' => $model->users->nickname,
- ];
- }
- }
|