我有以下型号。
Shipment
ShipmentPiece
Shipment
可以有多个ShipmentPiece
个实例。 ShipmentPiece
属于Shipment
。
当我将新creating
附加到saving
时,是否存在模型事件(与ShipmentPiece
或Shipment
相同)?
例如,当我这样做时:
$shipment->shipmentPieces()->save($shipmentPiece);
或
$shipment->shipmentPieces()->saveMany([$piece1, $piece2]);
我想在Shipment
类中的boot
类中运行一些逻辑。