Files
water-back/app/Api/Resources/User/UserDataResource.php
2023-01-11 11:00:43 +08:00

23 lines
562 B
PHP

<?php
namespace App\Api\Resources\User;
use Illuminate\Http\Resources\Json\JsonResource;
class UserDataResource extends JsonResource
{
public function toArray($request): array
{
return [
'user_id' => $this->id,
'username' => $this->username,
'nickname' => $this->info->nickname,
'orders_count' => $this->orders_count,
'orders_sum_amount' => $this->orders_sum_amount,
'avatar' => $this->info->avatar ?? '',
];
}
}