71 lines
1.4 KiB
PHP
71 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace app\common\model;
|
|
|
|
use support\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class PurchaseOrderItems extends Model
|
|
{
|
|
|
|
use SoftDeletes;
|
|
|
|
|
|
/**
|
|
* The connection name for the model.
|
|
*
|
|
* @var string|null
|
|
*/
|
|
protected $connection = 'mysql';
|
|
|
|
/**
|
|
* The table associated with the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'purchase_order_items';
|
|
|
|
/**
|
|
* The primary key associated with the table.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $primaryKey = 'id';
|
|
|
|
/**
|
|
* Indicates if the model should be timestamped.
|
|
*
|
|
* @var bool
|
|
*/
|
|
public $timestamps = true;
|
|
|
|
|
|
protected $dateFormat = 'U';
|
|
|
|
/**
|
|
* 允许自动填充模型字段
|
|
*/
|
|
protected $fillable = ['id', 'purchase_order_id', 'stock_id', 'stock_items_id', 'stock_items_uqid', 'quantity', 'unit_price', 'total_price', 'remark'];
|
|
|
|
/**
|
|
* 不允许自动填充模型字段
|
|
*/
|
|
protected $guarded = [];
|
|
|
|
|
|
public function purchaseOrder()
|
|
{
|
|
return $this->belongsTo(PurchaseOrders::class, 'purchase_order_id', 'id');
|
|
}
|
|
|
|
|
|
public function stockOrder()
|
|
{
|
|
return $this->belongsTo(StockOrders::class, 'stock_id', 'id');
|
|
}
|
|
|
|
public function stockOrderItems()
|
|
{
|
|
return $this->belongsTo(StockOrderItems::class, 'stock_items_id', 'id');
|
|
}
|
|
} |