RefundLogResource.php 680 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class RefundLogResource extends JsonResource
  5. {
  6. /**
  7. * Transform the resource into an array.
  8. *
  9. * @param \Illuminate\Http\Request $request
  10. * @return array
  11. */
  12. public function toArray($request)
  13. {
  14. $model = $this->resource;
  15. $data = [
  16. 'nickname' => $model->users->nickname ? ($model->users->nickname . "(" . $model->users->truename . ")") : '',
  17. 'mobile' => $model->users->mobile ?? '',
  18. 'area_name' => $model->area->name ?? '',
  19. ];
  20. return array_merge(parent::toArray($request),$data);
  21. }
  22. }