belongsTo(User::class,'user_id'); } public function useraa(){ return $this->hasOne(User::class,'id','user_id'); } public function address(){ return $this->belongsTo(AddressW::class,'address_id'); } public function address_store(){ return $this->hasOne(AddressW::class,'store_id'); } public function getIntegralAttribute($value){ return round($value); } public static function getTest(){ return []; } //测试 // public function getNameAttribute($value){ // return '【 '.$value.' 】'; // } // // protected $appends = ['info']; // // public function getInfoAttribute() // { // return $this->user_id.'-'.$this->name.'-'.$this->attributes['name']; // } // // public function setNameAttribute($value) // { // $this->attributes['name']='【'.$value.'】'; // } }