33 lines
676 B
PHP
33 lines
676 B
PHP
<?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();
|
|
}
|
|
}
|