Browse Source

增加agentProduct表关联和pictures判断

dev
李可松 4 years ago
parent
commit
8398aed898
  1. 7
      app/Models/Order.php

7
app/Models/Order.php

@ -41,7 +41,7 @@ class Order extends BaseModel
public function getRefundInfoAttribute($value) public function getRefundInfoAttribute($value)
{ {
$value = $value ? json_decode($value, true) : []; $value = $value ? json_decode($value, true) : [];
if (is_array($value['pictures'])) {
if (!empty($value['pictures']) && is_array($value['pictures'])) {
foreach ($value['pictures'] as &$v) { foreach ($value['pictures'] as &$v) {
$v = $this->host . $v; $v = $this->host . $v;
} }
@ -49,6 +49,11 @@ class Order extends BaseModel
return $value ?? []; return $value ?? [];
} }
public function agentProduct()
{
return $this->belongsTo(AgentProduct::class);
}
public function product() public function product()
{ {
return $this->belongsTo(Product::class); return $this->belongsTo(Product::class);

Loading…
Cancel
Save