Files
fdesk/app/common/model/PurchaseOrders.php
T

64 lines
1.2 KiB
PHP

<?php
namespace app\common\model;
use support\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class PurchaseOrders 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_orders';
/**
* 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', 'order_no', 'pi_no', 'buyer_id', 'buyer_name', 'contract_file', 'status', 'remark', 'is_draft', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
public function items()
{
return $this->hasMany(PurchaseOrderItems::class, 'purchase_order_id', 'id');
}
public function buyer()
{
return $this->hasOne(User::class, 'id', 'buyer_id');
}
}