<?php

namespace app\model;

use support\Model;

class GoodsComponent extends Model
{
    protected $table = 'goods_component';

    protected $primaryKey = 'goods_component_id';

    protected $dateFormat = 'U';

    const CREATED_AT = 'goods_component_addtimes';

    const UPDATED_AT = null;

    public function package()
    {
        return $this->hasOne(Goods::class, 'goods_id', 'join_component_master_goods_id')
            ->select('goods_name', 'goods_market_price', 'goods_sales_price', 'goods_cover');
    }

    public function goods()
    {
        return $this->hasOne(Goods::class, 'goods_id', 'join_component_goods_id')
            ->select('goods_id', 'goods_name', 'goods_market_price', 'goods_sales_price', 'goods_cover','join_goods_supplier_id');
    }
}