36 lines
892 B
PHP
36 lines
892 B
PHP
|
|
<?php
|
|||
|
|
|
|||
|
|
namespace App\Modules\Procurement\Models;
|
|||
|
|
|
|||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|||
|
|
use Illuminate\Database\Eloquent\Model;
|
|||
|
|
|
|||
|
|
class ShippingOrderItem extends Model
|
|||
|
|
{
|
|||
|
|
use HasFactory;
|
|||
|
|
|
|||
|
|
protected $fillable = [
|
|||
|
|
'shipping_order_id',
|
|||
|
|
'product_id',
|
|||
|
|
'batch_number',
|
|||
|
|
'quantity',
|
|||
|
|
'unit_price',
|
|||
|
|
'subtotal',
|
|||
|
|
'remark',
|
|||
|
|
];
|
|||
|
|
|
|||
|
|
protected $casts = [
|
|||
|
|
'quantity' => 'decimal:4',
|
|||
|
|
'unit_price' => 'decimal:4',
|
|||
|
|
'subtotal' => 'decimal:2',
|
|||
|
|
];
|
|||
|
|
|
|||
|
|
public function shippingOrder()
|
|||
|
|
{
|
|||
|
|
return $this->belongsTo(ShippingOrder::class);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 注意:在模組化架構下,跨模組關聯應謹慎使用或是直接在 Controller 水和 (Hydration)
|
|||
|
|
// 但為了開發便利,暫時保留對 Product 的關聯(如果 Product 在不同模組,可能無法直接 lazy load)
|
|||
|
|
}
|