Skip to content

Commit

Permalink
Fix tests !
Browse files Browse the repository at this point in the history
  • Loading branch information
lguichard committed Oct 2, 2024
1 parent 03e895c commit 9a8dfdd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/core/src/Observers/OrderLineObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ public function creating(OrderLine $orderLine)
*/
public function updating(OrderLine $orderLine)
{
if (! in_array(Purchasable::class, class_implements(Relation::getMorphedModel($orderLine->purchasable_type), true))) {
$purchasableModel = class_exists($orderLine->purchasable_type) ?
$orderLine->purchasable_type :
Relation::getMorphedModel($orderLine->purchasable_type);

if (! in_array(Purchasable::class, class_implements($purchasableModel, true))) {
throw new NonPurchasableItemException($orderLine->purchasable_type);
}
}
Expand Down

0 comments on commit 9a8dfdd

Please sign in to comment.