From 02fd5640b415ffc494f28f561b54fd2e82ce0446 Mon Sep 17 00:00:00 2001 From: "Fabian @ Blax Software" Date: Wed, 3 Jun 2026 10:37:09 +0200 Subject: [PATCH] feat(enums): add SUBSCRIPTION product type Real consumer data has products typed 'subscription' (a service sold on a recurring basis) alongside 'service'/'simple'. Add ProductType::SUBSCRIPTION so a host whose catalogue uses that value can cast products through the enum without a value clash. No stock semantics (like SERVICE). --- README.md | 4 ++-- src/Enums/ProductType.php | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 65c31ea..78c28d5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Tests](https://github.com/blax-software/laravel-shop/actions/workflows/tests.yml/badge.svg)](https://github.com/blax-software/laravel-shop/actions/workflows/tests.yml) [![Tests Count](https://img.shields.io/badge/tests-1409%20passing-success?style=flat-square)](#testing) -[![Assertions](https://img.shields.io/badge/assertions-3773-blue?style=flat-square)](#testing) +[![Assertions](https://img.shields.io/badge/assertions-3774-blue?style=flat-square)](#testing) [![Latest Version](https://img.shields.io/packagist/v/blax-software/laravel-shop.svg?style=flat-square)](https://packagist.org/packages/blax-software/laravel-shop) [![License](https://img.shields.io/packagist/l/blax-software/laravel-shop.svg?style=flat-square)](https://packagist.org/packages/blax-software/laravel-shop) [![PHP Version](https://img.shields.io/packagist/php-v/blax-software/laravel-shop.svg?style=flat-square)](https://packagist.org/packages/blax-software/laravel-shop) @@ -192,7 +192,7 @@ booking, Stripe sync and the event surface — so host applications can lean on the behaviour with confidence. ``` -Tests: 1409, Assertions: 3773 +Tests: 1409, Assertions: 3774 ``` CI runs the full suite on every push (see the badge above). To run it diff --git a/src/Enums/ProductType.php b/src/Enums/ProductType.php index 91f9805..c1518a1 100644 --- a/src/Enums/ProductType.php +++ b/src/Enums/ProductType.php @@ -26,6 +26,14 @@ enum ProductType: string * from services apart. */ case SERVICE = 'service'; + /** + * Subscription: a service sold on a recurring basis (the actual cadence + * lives on the {@see \Blax\Shop\Models\ProductPrice} as a recurring price). + * Like SERVICE it carries no physical stock; the distinct type lets hosts + * model "this product is fundamentally a subscription" for catalogue and + * reporting. + */ + case SUBSCRIPTION = 'subscription'; public function label(): string { @@ -39,6 +47,7 @@ enum ProductType: string self::POOL => 'Pool', self::LOANABLE => 'Loanable', self::SERVICE => 'Service', + self::SUBSCRIPTION => 'Subscription', }; } }