belongsTo('User','user_id','id'); } //获取等级名 public function getVipAttr($value) { $vip = [0=>'普通',1=>'L1',2=>'L2',3=>'L3',4=>'L4',5=>'L5']; return $vip[$value]; } }