mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-25 17:54:57 +01:00
23 lines
501 B
PHP
23 lines
501 B
PHP
<?php
|
|
|
|
namespace App\Api\v1\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
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->when(Auth::guard('api')->user(), $this->email),
|
|
];
|
|
}
|
|
} |