Files
fdesk/app/common/model/FinReceipt.php
T
mzl92 aabd0f4634 Merge branch 'develop'
# Conflicts:
#	app/admin/controller/dashboard/FinStatisticsController.php
#	app/common/controller/FinPaymentApplyController.php
#	app/common/controller/FinReceiptController.php
#	app/common/logic/FinReceiptLogic.php
#	app/common/model/FinPaymentApply.php
#	app/common/model/FinReceipt.php
#	app/common/service/FinPaymentApplyService.php
#	app/common/service/FinReceiptService.php
#	app/common/service/StockOrdersService.php
#	config/route.php
2025-11-04 10:36:52 +08:00

81 lines
1.9 KiB
PHP

<?php
namespace app\common\model;
use support\Model;
class FinReceipt extends Model
{
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'mysql';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'fin_receipt';
/**
* 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', 'receipt_no', 'payment_apply_id', 'country_id', 'remitter', 'account_id', 'currency_id', 'amount', 'discount_amount', 'total_amount_cny', 'exchange_rate', 'arrived_at', 'received_at', 'voucher_no', 'fx_receipt_file', 'fx_receipt_file_name', 'is_domestic_return', 'submit_files', 'created_by', 'updated_by', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
*/
protected $guarded = [];
/**
* 对应的付款申请(1-1,可为空)
*/
public function payment()
{
return $this->belongsTo(FinPaymentApply::class, 'payment_apply_id', 'id');
}
/**
* 关联的备货单(通过中间表)
*/
public function stocks()
{
return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'receipt_id', 'stock_id');
}
/**
* 关联付款申请
*/
// public function finPaymentApply()
// {
// return $this->hasOne(FinPaymentApply::class, 'receipt_id', 'id');
// }
/**
* 关联付款申请表
*/
public function paymentApply()
{
return $this->belongsTo(FinPaymentApply::class, 'payment_apply_id', 'id');
}
}