model设置返回字段

浏览:643 发布日期:2020/09/25 分类:ThinkPHP5专区
th5怎么在model设置要返回的字段
public function fields()
{
return [
'actor_id',
'area_id',
'actor_name',
'avatar' => function() {
return $this->avatar->toUrl();
},
'type' => function() {
return $this->type;
},
'type_name' => function() {
return self::$actionMap[$this->type];
}
];
}

类似这种的
最佳答案
评论( 相关
后面还有条评论,点击查看>>