You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
user_center/app/Http/Resources/SystemSetting.php

35 lines
984 B

4 years ago
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class SystemSetting extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
$status_txts = [0 => '删除', 1 => '启用', 2 => '关闭'];
return [
'id' => $this->id,
'name' => $this->name,
'data_type' => $this->data_type,
'title' => $this->title,
'group' => $this->group,
'prop' => $this->prop,
'content' => $this->content,
'remark' => $this->remark,
'sort' => $this->sort,
'status' => $this->status,
'status_txt' => $status_txts[$this->status],
'created_at' => $this->created_at->toDateTimeString(),
'updated_at' => $this->updated_at->toDateTimeString()
];
}
}