6
0
Fork 0
jiqu-library-server/app/Models/OrderRefundTask.php

49 lines
909 B
PHP

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