<?php

namespace App\Models;

use App\Models\traits\Filter;

class GoodsSkuLocation extends Model
{
    use Filter;
    public $fieldSearchable = [
        'date',
        'goods_title',
        'goods_code',
        'external_sku_id',
        'location',
        'status',
    ];

    public function goods()
    {
        return $this->belongsTo(Goods::class, 'goods_id', 'id');
    }

    public function goodsSku()
    {
        return $this->belongsTo(GoodsSku::class, 'goods_sku_id', 'id');
    }

    public function getStatusAttribute($value)
    {
        $map = ['未使用', '正常', '过期'];

        return $map[$value];
    }
}
