31 lines
561 B
PHP
31 lines
561 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use Storage;
|
|
|
|
/**
|
|
* @mixin \App\User
|
|
*/
|
|
class UserResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
*
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'name' => $this->name,
|
|
'email' => $this->email,
|
|
'avatar' => [
|
|
'src' => Storage::url('avatar.png'),
|
|
],
|
|
];
|
|
}
|
|
}
|