27 lines
616 B
PHP
27 lines
616 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Resources\Api;
|
||
|
|
||
|
use App\Models\Enum\UserEnum;
|
||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||
|
|
||
|
class UserResource extends JsonResource
|
||
|
{
|
||
|
/**
|
||
|
* Transform the resource into an array.
|
||
|
*
|
||
|
* @param \Illuminate\Http\Request $request
|
||
|
* @return array
|
||
|
*/
|
||
|
public function toArray($request)
|
||
|
{
|
||
|
return [
|
||
|
'id'=>$this->id,
|
||
|
'name' => $this->name,
|
||
|
'status' => UserEnum::getStatusName($this->status),
|
||
|
'created_at'=>(string)$this->created_at,
|
||
|
'updated_at'=>(string)$this->updated_at
|
||
|
];
|
||
|
}
|
||
|
}
|