2024-02-01 12:49:25 +00:00

29 lines
676 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class UserResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'name' => $this->name,
'email' => $this->email,
'bio' => $this->bio,
'image_path' => $this->image_path,
'followers' => $this->followers,
'followings' => $this->followings,
'articles' => $this->articles,
];
}
}