2020-04-10 20:32:12 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
use Storage;
|
|
|
|
|
2022-01-02 12:32:57 +01:00
|
|
|
/**
|
2022-02-19 18:06:07 +01:00
|
|
|
* @mixin \App\User
|
2022-01-02 12:32:57 +01:00
|
|
|
*/
|
2020-04-10 20:32:12 +02:00
|
|
|
class UserResource extends JsonResource
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Transform the resource into an array.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function toArray($request)
|
|
|
|
{
|
|
|
|
return [
|
2022-02-19 18:06:07 +01:00
|
|
|
'name' => $this->name,
|
|
|
|
'email' => $this->email,
|
2020-04-10 20:32:12 +02:00
|
|
|
'avatar' => [
|
|
|
|
'src' => Storage::url('avatar.png')
|
|
|
|
]
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|