feat(cart): implement cart editing policies and update related functionality

This commit is contained in:
2026-08-19 10:15:37 -03:00
parent 67e6211857
commit 014b5bb012
20 changed files with 305 additions and 39 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Domains\Tenant\Enums;
enum CartEditingPolicy: string
{
case Disabled = 'disabled';
case QuantityAndRemove = 'quantity_and_remove';
case Full = 'full';
public function allowsQuantityChanges(): bool
{
return $this !== self::Disabled;
}
public function allowsRemoval(): bool
{
return $this !== self::Disabled;
}
public function allowsVariantChanges(): bool
{
return $this === self::Full;
}
public function allowsModification(): bool
{
return $this->allowsRemoval()
|| $this->allowsQuantityChanges()
|| $this->allowsVariantChanges();
}
}