29 lines
777 B
PHP
29 lines
777 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class MerchantOrder extends BaseModel
|
|
{
|
|
//
|
|
public function merchants()
|
|
{
|
|
return $this->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 '<b style="color:'.$config_color[$this->status].'">'.$config[$this->status].'</b>';
|
|
}
|
|
}
|