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;
|
|
|
|
|
2022-09-07 17:54:27 +02:00
|
|
|
/**
|
|
|
|
* @property mixed $id
|
|
|
|
* @property string $name
|
|
|
|
* @property string $email
|
2023-12-09 17:22:24 +01:00
|
|
|
* @property string $oauth_provider
|
2023-09-27 10:50:21 +02:00
|
|
|
* @property \Illuminate\Support\Collection<array-key, mixed> $preferences
|
2023-02-19 23:00:39 +01:00
|
|
|
* @property string $is_admin
|
2022-09-07 17:54:27 +02:00
|
|
|
*/
|
2021-10-01 13:40:37 +02:00
|
|
|
class UserResource extends JsonResource
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Transform the resource into an array.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function toArray($request)
|
|
|
|
{
|
|
|
|
return [
|
2023-12-09 17:22:24 +01:00
|
|
|
'id' => $this->id,
|
|
|
|
'name' => $this->name,
|
|
|
|
'email' => $this->email,
|
|
|
|
'oauth_provider' => $this->oauth_provider,
|
|
|
|
'preferences' => $this->preferences,
|
|
|
|
'is_admin' => $this->is_admin,
|
2021-10-01 13:40:37 +02:00
|
|
|
];
|
|
|
|
}
|
2022-11-22 15:15:52 +01:00
|
|
|
}
|