<?php

namespace app\common\model;

use app\common\model\Allocation;
use app\common\model\Base;

/**
 * 
 * @property int $good_id 物品id
 * @property number $num 数量
 */
class AllocationDetail extends Base
{
    protected $schema = [
        'id'     => 'int',       // id
        'good_id'        => 'int',       // 物品ID
        'create_time'    => 'datetime',  // 创建时间
        'update_time'    => 'datetime',  // 更新时间
        'delete_time'    => 'datetime',  // 删除时间
        'valid'  => 'tinyint',   // 状态,1启用,0禁用
        'num'    => 'float',     // 数量
        'date'   => 'date',      // 出入库日期
        'remark'         => 'varchar',   // 备注
        'allocation_id'  => 'int',       // 调拔单订单ID
    ];

    public function allocation()
    {
        return $this->belongsTo(Allocation::class);
    }

    public function good()
    {
        return $this->belongsTo(Good::class);
    }
}