adrema/app/Http/Resources/UserResource.php

31 lines
561 B
PHP
Raw Normal View History

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.
*
2022-03-11 20:19:17 +01:00
* @param \Illuminate\Http\Request $request
*
2020-04-10 20:32:12 +02:00
* @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' => [
2022-03-11 20:19:17 +01:00
'src' => Storage::url('avatar.png'),
],
2020-04-10 20:32:12 +02:00
];
}
}