belongsTo('App\Models\Merchant', 'merchant_id', 'id')->withDefault([ 'name' => '本站' ]); } public function merchants2() { return $this->belongsTo('App\Models\Merchant', 'from_merchant_id', 'id')->withDefault([ 'name' => '本站' ]); } public function getOrderStatusName2Attribute() { $config =[0=>'未支付',1=>'交易完成',2=>'交易失败']; $config_color= config('adconfig.order_status_color'); return ''.$config[$this->status].''; } }