Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120838832
Base.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
Base.php
View Options
<?php
namespace
App\Handlers\Beta
;
class
Base
extends
\App\Handlers\Base
{
/**
* Check if the SKU is available to the user/domain.
*
* @param \App\Sku $sku The SKU object
* @param \App\User|\App\Domain $object The user or domain object
*
* @return bool
*/
public
static
function
isAvailable
(
\App\Sku
$sku
,
$object
):
bool
{
// These SKUs must be:
// 1) already assigned or
// 2) active and a 'beta' entitlement must exist.
if
(!
$object
instanceof
\App\User
)
{
return
false
;
}
if
(
$sku
->
active
)
{
return
$object
->
hasSku
(
'beta'
);
}
else
{
if
(
$object
->
entitlements
()->
where
(
'sku_id'
,
$sku
->
id
)->
first
())
{
return
true
;
}
}
return
false
;
}
/**
* SKU handler metadata.
*
* @param \App\Sku $sku The SKU object
*
* @return array
*/
public
static
function
metadata
(
\App\Sku
$sku
):
array
{
$data
=
parent
::
metadata
(
$sku
);
$data
[
'required'
]
=
[
'Beta'
];
return
$data
;
}
/**
* Prerequisites for the Entitlement to be applied to the object.
*
* @param \App\Entitlement $entitlement
* @param mixed $object
*
* @return bool
*/
public
static
function
preReq
(
$entitlement
,
$object
):
bool
{
if
(!
parent
::
preReq
(
$entitlement
,
$object
))
{
return
false
;
}
// TODO: User has to have the "beta" entitlement
return
true
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 2:04 PM (1 w, 20 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18883341
Default Alt Text
Base.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline