58 lines
1.0 KiB
PHP
58 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class OrderRefundLog extends Model
|
|
{
|
|
public const STATUS_PENDING = 0;
|
|
public const STATUS_SUCCESS = 4;
|
|
public const STATUS_FAILED = 5;
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $attributes = [
|
|
'status' => self::STATUS_PENDING,
|
|
];
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'sn',
|
|
'order_id',
|
|
'after_sale_id',
|
|
'amount',
|
|
'status',
|
|
'reason',
|
|
'failed_reason',
|
|
];
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $statusTexts = [
|
|
self::STATUS_PENDING => '待处理',
|
|
self::STATUS_SUCCESS => '成功',
|
|
self::STATUS_FAILED => '失败',
|
|
];
|
|
|
|
/**
|
|
* 只查询待退款的记录
|
|
*/
|
|
public function scopePending($query)
|
|
{
|
|
return $query->where('status', static::STATUS_PENDING);
|
|
}
|
|
|
|
/**
|
|
* 此退款记录所属的订单
|
|
*/
|
|
public function order()
|
|
{
|
|
return $this->belongsTo(Order::class);
|
|
}
|
|
}
|