Changeset View
Changeset View
Standalone View
Standalone View
src/app/Handlers/Beta.php
- This file was copied from src/app/Handlers/Base.php.
<?php | <?php | ||||
namespace App\Handlers; | namespace App\Handlers; | ||||
abstract class Base | class Beta extends \App\Handlers\Base | ||||
{ | { | ||||
/** | /** | ||||
* The entitleable class for this handler. | * The entitleable class for this handler. | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public static function entitleableClass(): string | public static function entitleableClass(): string | ||||
{ | { | ||||
return ''; | return \App\User::class; | ||||
} | } | ||||
/** | /** | ||||
* Prerequisites for the Entitlement to be applied to the object. | * Prerequisites for the Entitlement to be applied to the object. | ||||
* | * | ||||
* @param \App\Entitlement $entitlement | * @param \App\Entitlement $entitlement | ||||
* @param mixed $object | * @param mixed $object | ||||
* | * | ||||
* @return bool | * @return bool | ||||
*/ | */ | ||||
public static function preReq($entitlement, $object): bool | public static function preReq($entitlement, $object): bool | ||||
{ | { | ||||
// We allow inactive "beta" Sku to be assigned | |||||
if (self::entitleableClass() !== $entitlement->entitleable_type) { | |||||
\Log::error("Entitleable class mismatch"); | |||||
return false; | |||||
} | |||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
* The priority that specifies the order of SKUs in UI. | * The priority that specifies the order of SKUs in UI. | ||||
* Higher number means higher on the list. | * Higher number means higher on the list. | ||||
* | * | ||||
* @return int | * @return int | ||||
*/ | */ | ||||
public static function priority(): int | public static function priority(): int | ||||
{ | { | ||||
return 0; | // Just above all other beta SKUs, please | ||||
return 10; | |||||
} | } | ||||
} | } |