InviteNewUserResource.php 959 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Resources\Json\JsonResource;
  4. class InviteNewUserResource 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. return [
  16. 'id' => $model->id,
  17. 'invite_nickname' => ($model->invite->nickname ??'').'('.($model->invite->truename ?? '').')',
  18. 'invite_mobile' => $model->invite->mobile ?? '',
  19. 'register_nickname' => $model->register->nickname ?? '',
  20. 'register_mobile' => $model->register->mobile ?? '',
  21. 'is_card_certified' => $model->is_card_certified,
  22. 'is_first_order' => $model->is_first_order,
  23. 'status' => $model->status,
  24. 'created_at' => $model->created_at->format('Y-m-d H:i:s'),
  25. ];
  26. }
  27. }