2021-10-01 13:40:37 +02:00
|
|
|
<?php
|
|
|
|
|
2021-11-07 21:57:22 +01:00
|
|
|
namespace App\Api\v1\Resources;
|
2021-10-01 13:40:37 +02:00
|
|
|
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
|
|
|
class UserResource extends JsonResource
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Transform the resource into an array.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function toArray($request)
|
|
|
|
{
|
|
|
|
return [
|
2022-03-24 14:58:30 +01:00
|
|
|
'id' => $this->when($request->user(), $this->id),
|
2021-10-01 13:40:37 +02:00
|
|
|
'name' => $this->name,
|
2022-03-24 14:58:30 +01:00
|
|
|
'email' => $this->when($request->user(), $this->email),
|
2021-10-01 13:40:37 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|