Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2485244
SkuSeeder.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
SkuSeeder.php
View Options
<?php
namespace
Database\Seeds
;
use
App\Sku
;
use
Illuminate\Database\Seeder
;
class
SkuSeeder
extends
Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public
function
run
()
{
$skus
=
[
[
'title'
=>
'mailbox'
,
'name'
=>
'User Mailbox'
,
'description'
=>
'Just a mailbox'
,
'cost'
=>
500
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\M
ailbox'
,
'active'
=>
true
,
],
[
'title'
=>
'domain'
,
'name'
=>
'Hosted Domain'
,
'description'
=>
'Somewhere to place a mailbox'
,
'cost'
=>
100
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\D
omain'
,
'active'
=>
false
,
],
[
'title'
=>
'domain-registration'
,
'name'
=>
'Domain Registration'
,
'description'
=>
'Register a domain with us'
,
'cost'
=>
101
,
'period'
=>
'yearly'
,
'handler_class'
=>
'App
\H
andlers
\D
omainRegistration'
,
'active'
=>
false
,
],
[
'title'
=>
'domain-hosting'
,
'name'
=>
'External Domain'
,
'description'
=>
'Host a domain that is externally registered'
,
'cost'
=>
100
,
'units_free'
=>
1
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\D
omainHosting'
,
'active'
=>
true
,
],
[
'title'
=>
'domain-relay'
,
'name'
=>
'Domain Relay'
,
'description'
=>
'A domain you host at home, for which we relay email'
,
'cost'
=>
103
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\D
omainRelay'
,
'active'
=>
false
,
],
[
'title'
=>
'storage'
,
'name'
=>
'Storage Quota'
,
'description'
=>
'Some wiggle room'
,
'cost'
=>
25
,
'units_free'
=>
5
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\S
torage'
,
'active'
=>
true
,
],
[
'title'
=>
'groupware'
,
'name'
=>
'Groupware Features'
,
'description'
=>
'Groupware functions like Calendar, Tasks, Notes, etc.'
,
'cost'
=>
490
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\G
roupware'
,
'active'
=>
true
,
],
[
'title'
=>
'resource'
,
'name'
=>
'Resource'
,
'description'
=>
'Reservation taker'
,
'cost'
=>
101
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\R
esource'
,
'active'
=>
true
,
],
[
'title'
=>
'shared-folder'
,
'name'
=>
'Shared Folder'
,
'description'
=>
'A shared folder'
,
'cost'
=>
89
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\S
haredFolder'
,
'active'
=>
true
,
],
[
'title'
=>
'2fa'
,
'name'
=>
'2-Factor Authentication'
,
'description'
=>
'Two factor authentication for webmail and administration panel'
,
'cost'
=>
0
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\A
uth2F'
,
'active'
=>
true
,
],
[
'title'
=>
'activesync'
,
'name'
=>
'Activesync'
,
'description'
=>
'Mobile synchronization'
,
'cost'
=>
0
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\A
ctivesync'
,
'active'
=>
true
,
],
[
'title'
=>
'beta'
,
'name'
=>
'Private Beta (invitation only)'
,
'description'
=>
'Access to the private beta program features'
,
'cost'
=>
0
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\B
eta'
,
'active'
=>
false
,
],
[
'title'
=>
'group'
,
'name'
=>
'Distribution list'
,
'description'
=>
'Mail distribution list'
,
'cost'
=>
0
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\G
roup'
,
'active'
=>
true
,
],
[
'title'
=>
'group-room'
,
'name'
=>
'Group conference room'
,
'description'
=>
'Shareable audio & video conference room'
,
'cost'
=>
0
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\G
roupRoom'
,
'active'
=>
true
,
],
[
'title'
=>
'room'
,
'name'
=>
'Standard conference room'
,
'description'
=>
'Audio & video conference room'
,
'cost'
=>
0
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\R
oom'
,
'active'
=>
true
,
],
];
foreach
(
$skus
as
$sku
)
{
// Check existence because migration might have added this already
if
(!
Sku
::
where
(
'title'
,
$sku
[
'title'
])->
where
(
'tenant_id'
,
\config
(
'app.tenant_id'
))->
first
())
{
Sku
::
create
(
$sku
);
}
}
$skus
=
[
[
'title'
=>
'mailbox'
,
'name'
=>
'User Mailbox'
,
'description'
=>
'Just a mailbox'
,
'cost'
=>
500
,
'fee'
=>
333
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\M
ailbox'
,
'active'
=>
true
,
],
[
'title'
=>
'storage'
,
'name'
=>
'Storage Quota'
,
'description'
=>
'Some wiggle room'
,
'cost'
=>
25
,
'fee'
=>
16
,
'units_free'
=>
5
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\S
torage'
,
'active'
=>
true
,
],
[
'title'
=>
'domain-hosting'
,
'name'
=>
'External Domain'
,
'description'
=>
'Host a domain that is externally registered'
,
'cost'
=>
100
,
'fee'
=>
66
,
'units_free'
=>
1
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\D
omainHosting'
,
'active'
=>
true
,
],
[
'title'
=>
'groupware'
,
'name'
=>
'Groupware Features'
,
'description'
=>
'Groupware functions like Calendar, Tasks, Notes, etc.'
,
'cost'
=>
490
,
'fee'
=>
327
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\G
roupware'
,
'active'
=>
true
,
],
[
'title'
=>
'2fa'
,
'name'
=>
'2-Factor Authentication'
,
'description'
=>
'Two factor authentication for webmail and administration panel'
,
'cost'
=>
0
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\A
uth2F'
,
'active'
=>
true
,
],
[
'title'
=>
'activesync'
,
'name'
=>
'Activesync'
,
'description'
=>
'Mobile synchronization'
,
'cost'
=>
0
,
'units_free'
=>
0
,
'period'
=>
'monthly'
,
'handler_class'
=>
'App
\H
andlers
\A
ctivesync'
,
'active'
=>
true
,
],
];
// for tenants that are not the configured tenant id
$tenants
=
\App\Tenant
::
where
(
'id'
,
'!='
,
\config
(
'app.tenant_id'
))->
get
();
foreach
(
$tenants
as
$tenant
)
{
foreach
(
$skus
as
$sku
)
{
$sku
=
Sku
::
create
(
$sku
);
$sku
->
tenant_id
=
$tenant
->
id
;
$sku
->
save
();
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 21, 11:45 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
387451
Default Alt Text
SkuSeeder.php (8 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment