attributes['sell']; $status[static::OPEN] = '开启'; $status[static::CLOSE] = '关闭'; return $status[$value]; } public function getBuyStatusAttribute() { $value = $this->attributes['buy']; $status[static::OPEN] = '开启'; $status[static::CLOSE] = '关闭'; return $status[$value]; } public function getStatusNameAttribute() { $value = $this->attributes['status']; $status[static::STOP] = '已停止'; $status[static::START] = '已开启'; return $status[$value]; } public function getCreateDateAttribute() { $value = $this->attributes['create_time']; return date('Y-m-d H:i:s', $value); } public function getBuyUserInfoAttribute() { return $this->hasOne('App\Users', 'id', 'buy_user_id')->value('phone') ?? ''; } public function getSellUserInfoAttribute() { return $this->hasOne('App\Users', 'id', 'sell_user_id')->value('phone') ?? ''; } public function getCurrencyInfoAttribute() { return $this->hasOne('App\Currency', 'id', 'currency_id')->value('name') ?? ''; } public function getLegalInfoAttribute() { return $this->hasOne('App\Currency', 'id', 'legal_id')->value('name') ?? ''; } }