摘要: 获取器,在获取数据的字段值后自动进行处理: class User extends Model { public function getStatusAttr($value) { $status = [-1=>'删除',0=>'禁用',1=>'正常',2=>'待审核']; return $status 阅读全文
posted @ 2020-07-24 16:58 HighKK 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 一对一关联,A表中一条数据对应B表中一条数据 class User extends Model{ public function profile() { return $this->hasOne('Profile')->field('id,name,email'); }} //hasOne('关联模 阅读全文
posted @ 2020-07-24 16:45 HighKK 阅读(171) 评论(0) 推荐(0) 编辑