This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccount/app/Http/Resources/API/User.php

33 lines
913 B
PHP
Raw Permalink Normal View History

2019-04-25 15:33:15 +00:00
<?php
namespace App\Http\Resources\API;
2019-12-02 13:26:32 +00:00
use Carbon\Carbon;
2019-04-25 15:33:15 +00:00
use Illuminate\Http\Resources\Json\JsonResource;
class User extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
2019-12-02 13:26:32 +00:00
$created_at = Carbon::parse($this->created_at);
$updated_at = Carbon::parse($this->updated_at);
2019-04-25 15:33:15 +00:00
return [
'id' => (int)$this->id,
'username' => $this->username,
2019-12-02 13:26:32 +00:00
'created_at' => $created_at->format("Y-m-d H:i:s e"),
'updated_at' => $updated_at->format("Y-m-d H:i:s e"),
2019-04-25 15:33:15 +00:00
'primaryMail' => $this->getMail(),
'status' => $this->status,
'inviteCode' => $this->inviteCode,
'developer' => (bool)$this->developer,
'admin' => (bool)$this->admin
];
}
2019-12-02 13:26:32 +00:00
}