<?php

namespace Modules\Mall\Models;

use App\Models\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Modules\Mall\Models\Traits\BelongsToRefund;

class RefundLog extends Model
{

    use BelongsToRefund;

    const UPDATED_AT = null;

    protected $table = 'mall_refund_logs';

    /**
     * Notes: 操作用户
     * @Author: 玄尘
     * @Date  : 2021/5/17 11:32
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
     */
    public function userable(): MorphTo
    {
        return $this->morphTo();
    }

    /**
     * Notes: 状态
     * @Author: 玄尘
     * @Date  : 2021/5/18 11:39
     * @return string
     */
    public function getStateTextAttribute(): string
    {
        return Refund::STATUS_MAP[$this->state] ?? '---';
    }

}
