Changeset View
Changeset View
Standalone View
Standalone View
src/app/Handlers/Distlist.php
Show All 9 Lines | class Distlist extends Beta\Base | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public static function entitleableClass(): string | public static function entitleableClass(): string | ||||
{ | { | ||||
return \App\User::class; | return \App\User::class; | ||||
} | } | ||||
/** | /** | ||||
* Check if the SKU is available to the user. | * Check if the SKU is available to the user/domain. | ||||
* | * | ||||
* @param \App\Sku $sku The SKU object | * @param \App\Sku $sku The SKU object | ||||
* @param \App\User $user The user object | * @param \App\User|\App\Domain $object The user or domain object | ||||
* | * | ||||
* @return bool | * @return bool | ||||
*/ | */ | ||||
public static function isAvailable(\App\Sku $sku, \App\User $user): bool | public static function isAvailable(\App\Sku $sku, $object): bool | ||||
{ | { | ||||
// This SKU must be: | // This SKU must be: | ||||
// - already assigned, or active and a 'beta' entitlement must exist | // - already assigned, or active and a 'beta' entitlement must exist | ||||
// - and this is a group account owner (custom domain) | // - and this is a group account owner (custom domain) | ||||
if (parent::isAvailable($sku, $user)) { | if (parent::isAvailable($sku, $object)) { | ||||
return $user->wallet()->entitlements() | return $object->wallet()->entitlements() | ||||
->where('entitleable_type', \App\Domain::class)->count() > 0; | ->where('entitleable_type', \App\Domain::class)->count() > 0; | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
/** | /** | ||||
* The priority that specifies the order of SKUs in UI. | * The priority that specifies the order of SKUs in UI. | ||||
Show All 9 Lines |