feat(cart): implement cart editing policies and update related functionality
This commit is contained in:
23
app/Domains/Tenant/Resources/CartEditingPolicyResource.php
Normal file
23
app/Domains/Tenant/Resources/CartEditingPolicyResource.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Tenant\Resources;
|
||||
|
||||
use App\Domains\Tenant\Enums\CartEditingPolicy;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/** @mixin CartEditingPolicy */
|
||||
class CartEditingPolicyResource extends JsonResource
|
||||
{
|
||||
/** @return array<string, bool|string> */
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'code' => $this->resource->value,
|
||||
'allow_modify' => $this->resource->allowsModification(),
|
||||
'allow_delete' => $this->resource->allowsRemoval(),
|
||||
'allow_update_quantity' => $this->resource->allowsQuantityChanges(),
|
||||
'allow_update_variant' => $this->resource->allowsVariantChanges(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ class TenantResource extends JsonResource
|
||||
'display_categories' => $this->display_categories,
|
||||
'display_seach_bar' => $this->display_seach_bar,
|
||||
'display_cart' => $this->display_cart,
|
||||
'cart_editing_enabled' => $this->cart_editing_enabled,
|
||||
'cart_editing_policy' => CartEditingPolicyResource::make($this->cart_editing_policy),
|
||||
'display_cart_item_images' => $this->display_cart_item_images,
|
||||
'scanner_category_validation_enabled' => $this->scanner_category_validation_enabled,
|
||||
'social_media' => $this->whenLoaded(
|
||||
|
||||
Reference in New Issue
Block a user