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).
This commit is contained in:
Fabian @ Blax Software 2026-06-03 10:37:09 +02:00
parent db827bbb8c
commit 02fd5640b4
2 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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',
};
}
}