I have the following models.
Shipment
ShipmentPiece
A Shipment
can have multiple ShipmentPiece
instances. A ShipmentPiece
belongs to a Shipment
.
Is there a model event (same as creating
or saving
) for when I attach a new ShipmentPiece
to a Shipment
?
For example, when I do:
$shipment->shipmentPieces()->save($shipmentPiece);
or
$shipment->shipmentPieces()->saveMany([$piece1, $piece2]);
I would like to run some logic in the Shipment
class, inside the boot
method.