<?php

namespace Modules\Mall\Models;

use App\Models\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class GoodsSpec extends Model
{

    protected $table = 'mall_goods_specs';

    /**
     * Notes   : 所属商品
     * @Date   : 2021/5/11 4:51 下午
     * @Author : < Jason.C >
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function goods(): BelongsTo
    {
        return $this->belongsTo(Goods::class);
    }

    /**
     * Notes   : 属性值
     * @Date   : 2021/5/11 4:52 下午
     * @Author : < Jason.C >
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function values(): HasMany
    {
        return $this->hasMany(GoodsSpecValue::class, 'spec_id');
    }

}