mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-30 19:09:21 +01:00
23 lines
499 B
PHP
23 lines
499 B
PHP
<?php
|
|
|
|
namespace App\Http\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),
|
|
];
|
|
}
|
|
} |