芝麻web文件管理V1.00
编辑当前文件:/home/digitalh/yeahea.digitalhubbd.com/app/Models/Refund.php
belongsTo(Shop::class); } /** * Get the order for the refund. */ public function order() { return $this->belongsTo(Order::class); } /** * Get the customer for the refund. */ // public function customer() // { // return $this->order->customer(); // } /** * Set the order_fulfilled. */ public function setOrderFulfilledAttribute($value) { $this->attributes['order_fulfilled'] = (bool) $value; } /** * Set the return_goods. */ public function setReturnGoodsAttribute($value) { $this->attributes['return_goods'] = (bool) $value; } /** * Scope a query to only include records from the users shop. * * @return \Illuminate\Database\Eloquent\Builder */ public function scopeOpen($query) { return $query->where('status', '<', static::STATUS_APPROVED); } /** * Scope a query to only include records from the users shop. * * @return \Illuminate\Database\Eloquent\Builder */ public function scopeClosed($query) { return $query->where('status', '>=', static::STATUS_APPROVED); } /** * Scope a query to only include records that have the given status. * * @return \Illuminate\Database\Eloquent\Builder */ public function scopeStatusOf($query, $status) { return $query->where('status', $status); } /** * Check if the refund is open * * @return bool */ public function isOpen() { return $this->status < static::STATUS_APPROVED; } /** * Check if the refund has been approved * * @return bool */ public function isApproved() { return $this->status == static::STATUS_APPROVED; } /** * Check if the refund has been declined * * @return bool */ public function isDeclined() { return $this->status == static::STATUS_DECLINED; } public function statusName() { switch ($this->status) { case static::STATUS_NEW: return '
' . trans('app.statuses.new') . '
'; case static::STATUS_APPROVED: return '
' . trans('app.statuses.approved') . '
'; case static::STATUS_DECLINED: return '
' . trans('app.statuses.declined') . '
'; } } }