Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120823875
Package.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
Package.php
View Options
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
/**
* The eloquent definition of a Package.
*
* A package is a set of SKUs that a user can select, so that instead of;
*
* * Create a mailbox entitlement,
* * Create a quota entitlement,
* * Create a groupware entitlement,
* * ...
*
* users can simply select a 'package';
*
* * Kolab package: mailbox + quota + groupware,
* * Free package: mailbox + quota.
*
* Selecting a package will therefore create a set of entitlments from SKUs.
*/
class
Package
extends
Model
{
public
$incrementing
=
false
;
protected
$keyType
=
'string'
;
public
$timestamps
=
false
;
protected
$fillable
=
[
'title'
,
'description'
,
'discount_rate'
];
public
function
cost
()
{
$costs
=
0
;
foreach
(
$this
->
skus
as
$sku
)
{
$costs
+=
(
$sku
->
pivot
->
qty
-
$sku
->
units_free
)
*
$sku
->
cost
;
}
return
$costs
;
}
public
function
skus
()
{
return
$this
->
belongsToMany
(
'App
\S
ku'
,
'package_skus'
)->
using
(
'App
\P
ackageSku'
)->
withPivot
(
[
'qty'
]
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 10:13 AM (2 d, 7 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18814020
Default Alt Text
Package.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline