Changeset View
Changeset View
Standalone View
Standalone View
src/database/seeds/production/SkuSeeder.php
<?php | <?php | ||||
namespace Database\Seeds\Production; | namespace Database\Seeds\Production; | ||||
use App\Sku; | use App\Sku; | ||||
use Illuminate\Database\Seeder; | use Illuminate\Database\Seeder; | ||||
class SkuSeeder extends Seeder | class SkuSeeder extends Seeder | ||||
{ | { | ||||
/** | /** | ||||
* Run the database seeds. | * Run the database seeds. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function run() | public function run() | ||||
{ | { | ||||
Sku::create( | $skus = [ | ||||
[ | [ | ||||
'title' => 'mailbox', | 'title' => 'mailbox', | ||||
'name' => 'User Mailbox', | 'name' => 'User Mailbox', | ||||
'description' => 'Just a mailbox', | 'description' => 'Just a mailbox', | ||||
'cost' => 444, | 'cost' => 444, | ||||
'units_free' => 0, | 'units_free' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Mailbox', | 'handler_class' => 'App\Handlers\Mailbox', | ||||
'active' => true, | 'active' => true, | ||||
] | ], | ||||
); | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'domain', | 'title' => 'domain', | ||||
'name' => 'Hosted Domain', | 'name' => 'Hosted Domain', | ||||
'description' => 'Somewhere to place a mailbox', | 'description' => 'Somewhere to place a mailbox', | ||||
'cost' => 100, | 'cost' => 100, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Domain', | 'handler_class' => 'App\Handlers\Domain', | ||||
'active' => false, | 'active' => false, | ||||
] | ], | ||||
); | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'domain-registration', | 'title' => 'domain-registration', | ||||
'name' => 'Domain Registration', | 'name' => 'Domain Registration', | ||||
'description' => 'Register a domain with us', | 'description' => 'Register a domain with us', | ||||
'cost' => 101, | 'cost' => 101, | ||||
'period' => 'yearly', | 'period' => 'yearly', | ||||
'handler_class' => 'App\Handlers\DomainRegistration', | 'handler_class' => 'App\Handlers\DomainRegistration', | ||||
'active' => false, | 'active' => false, | ||||
] | ], | ||||
); | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'domain-hosting', | 'title' => 'domain-hosting', | ||||
'name' => 'External Domain', | 'name' => 'External Domain', | ||||
'description' => 'Host a domain that is externally registered', | 'description' => 'Host a domain that is externally registered', | ||||
'cost' => 100, | 'cost' => 100, | ||||
'units_free' => 1, | 'units_free' => 1, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\DomainHosting', | 'handler_class' => 'App\Handlers\DomainHosting', | ||||
'active' => true, | 'active' => true, | ||||
] | ], | ||||
); | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'domain-relay', | 'title' => 'domain-relay', | ||||
'name' => 'Domain Relay', | 'name' => 'Domain Relay', | ||||
'description' => 'A domain you host at home, for which we relay email', | 'description' => 'A domain you host at home, for which we relay email', | ||||
'cost' => 103, | 'cost' => 103, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\DomainRelay', | 'handler_class' => 'App\Handlers\DomainRelay', | ||||
'active' => false, | 'active' => false, | ||||
] | ], | ||||
); | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'storage', | 'title' => 'storage', | ||||
'name' => 'Storage Quota', | 'name' => 'Storage Quota', | ||||
'description' => 'Some wiggle room', | 'description' => 'Some wiggle room', | ||||
'cost' => 50, | 'cost' => 50, | ||||
'units_free' => 2, | 'units_free' => 2, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Storage', | 'handler_class' => 'App\Handlers\Storage', | ||||
'active' => true, | 'active' => true, | ||||
] | ], | ||||
); | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'groupware', | 'title' => 'groupware', | ||||
'name' => 'Groupware Features', | 'name' => 'Groupware Features', | ||||
'description' => 'Groupware functions like Calendar, Tasks, Notes, etc.', | 'description' => 'Groupware functions like Calendar, Tasks, Notes, etc.', | ||||
'cost' => 555, | 'cost' => 555, | ||||
'units_free' => 0, | 'units_free' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Groupware', | 'handler_class' => 'App\Handlers\Groupware', | ||||
'active' => true, | 'active' => true, | ||||
] | ], | ||||
); | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'resource', | 'title' => 'resource', | ||||
'name' => 'Resource', | 'name' => 'Resource', | ||||
'description' => 'Reservation taker', | 'description' => 'Reservation taker', | ||||
'cost' => 0, | 'cost' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Resource', | 'handler_class' => 'App\Handlers\Resource', | ||||
'active' => true, | 'active' => true, | ||||
] | ], | ||||
); | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'shared-folder', | 'title' => 'shared-folder', | ||||
'name' => 'Shared Folder', | 'name' => 'Shared Folder', | ||||
'description' => 'A shared folder', | 'description' => 'A shared folder', | ||||
'cost' => 89, | 'cost' => 89, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\SharedFolder', | 'handler_class' => 'App\Handlers\SharedFolder', | ||||
'active' => false, | 'active' => false, | ||||
] | ], | ||||
); | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => '2fa', | 'title' => '2fa', | ||||
'name' => '2-Factor Authentication', | 'name' => '2-Factor Authentication', | ||||
'description' => 'Two factor authentication for webmail and administration panel', | 'description' => 'Two factor authentication for webmail and administration panel', | ||||
'cost' => 0, | 'cost' => 0, | ||||
'units_free' => 0, | 'units_free' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Auth2F', | 'handler_class' => 'App\Handlers\Auth2F', | ||||
'active' => true, | 'active' => true, | ||||
] | ], | ||||
); | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'activesync', | 'title' => 'activesync', | ||||
'name' => 'Activesync', | 'name' => 'Activesync', | ||||
'description' => 'Mobile synchronization', | 'description' => 'Mobile synchronization', | ||||
'cost' => 100, | 'cost' => 100, | ||||
'units_free' => 0, | 'units_free' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Activesync', | 'handler_class' => 'App\Handlers\Activesync', | ||||
'active' => true, | 'active' => true, | ||||
] | ], | ||||
); | |||||
// Check existence because migration might have added this already | |||||
if (!Sku::where('title', 'beta')->first()) { | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'beta', | 'title' => 'beta', | ||||
'name' => 'Private Beta (invitation only)', | 'name' => 'Private Beta (invitation only)', | ||||
'description' => 'Access to the private beta program subscriptions', | 'description' => 'Access to the private beta program subscriptions', | ||||
'cost' => 0, | 'cost' => 0, | ||||
'units_free' => 0, | 'units_free' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Beta', | 'handler_class' => 'App\Handlers\Beta', | ||||
'active' => false, | 'active' => false, | ||||
] | ], | ||||
); | |||||
} | |||||
// Check existence because migration might have added this already | |||||
if (!Sku::where('title', 'meet')->first()) { | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'meet', | 'title' => 'meet', | ||||
'name' => 'Voice & Video Conferencing (public beta)', | 'name' => 'Voice & Video Conferencing (public beta)', | ||||
'description' => 'Video conferencing tool', | 'description' => 'Video conferencing tool', | ||||
'cost' => 0, | 'cost' => 0, | ||||
'units_free' => 0, | 'units_free' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Meet', | 'handler_class' => 'App\Handlers\Meet', | ||||
'active' => true, | 'active' => true, | ||||
] | ], | ||||
); | |||||
} | |||||
// Check existence because migration might have added this already | |||||
if (!Sku::where('title', 'group')->first()) { | |||||
Sku::create( | |||||
[ | [ | ||||
'title' => 'group', | 'title' => 'group', | ||||
'name' => 'Group', | 'name' => 'Group', | ||||
'description' => 'Distribution list', | 'description' => 'Distribution list', | ||||
'cost' => 0, | 'cost' => 0, | ||||
'units_free' => 0, | 'units_free' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Group', | 'handler_class' => 'App\Handlers\Group', | ||||
'active' => true, | 'active' => true, | ||||
] | ], | ||||
); | [ | ||||
} | 'title' => 'room', | ||||
'name' => 'Conference room', | |||||
// Check existence because migration might have added this already | 'description' => 'Audio & Video Conference room', | ||||
if (!Sku::where('title', 'beta-distlists')->first()) { | 'cost' => 0, | ||||
Sku::create([ | 'units_free' => 0, | ||||
'period' => 'monthly', | |||||
'handler_class' => 'App\Handlers\Room', | |||||
'active' => true, | |||||
], | |||||
[ | |||||
'title' => 'beta-distlists', | 'title' => 'beta-distlists', | ||||
'name' => 'Distribution lists', | 'name' => 'Distribution lists', | ||||
'description' => 'Access to mail distribution lists', | 'description' => 'Access to mail distribution lists', | ||||
'cost' => 0, | 'cost' => 0, | ||||
'units_free' => 0, | 'units_free' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Beta\Distlists', | 'handler_class' => 'App\Handlers\Beta\Distlists', | ||||
'active' => true, | 'active' => true, | ||||
]); | ], | ||||
} | [ | ||||
// Check existence because migration might have added this already | |||||
if (!Sku::where('title', 'beta-resources')->first()) { | |||||
Sku::create([ | |||||
'title' => 'beta-resources', | 'title' => 'beta-resources', | ||||
'name' => 'Calendaring resources', | 'name' => 'Calendaring resources', | ||||
'description' => 'Access to calendaring resources', | 'description' => 'Access to calendaring resources', | ||||
'cost' => 0, | 'cost' => 0, | ||||
'units_free' => 0, | 'units_free' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Beta\Resources', | 'handler_class' => 'App\Handlers\Beta\Resources', | ||||
'active' => true, | 'active' => true, | ||||
]); | ], | ||||
} | [ | ||||
// Check existence because migration might have added this already | |||||
if (!Sku::where('title', 'beta-shared-folders')->first()) { | |||||
Sku::create([ | |||||
'title' => 'beta-shared-folders', | 'title' => 'beta-shared-folders', | ||||
'name' => 'Shared folders', | 'name' => 'Shared folders', | ||||
'description' => 'Access to shared folders', | 'description' => 'Access to shared folders', | ||||
'cost' => 0, | 'cost' => 0, | ||||
'units_free' => 0, | 'units_free' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Beta\SharedFolders', | 'handler_class' => 'App\Handlers\Beta\SharedFolders', | ||||
'active' => true, | 'active' => true, | ||||
]); | ], | ||||
} | [ | ||||
// Check existence because migration might have added this already | |||||
if (!Sku::where('title', 'files')->first()) { | |||||
Sku::create([ | |||||
'title' => 'files', | 'title' => 'files', | ||||
'name' => 'File storage', | 'name' => 'File storage', | ||||
'description' => 'Access to file storage', | 'description' => 'Access to file storage', | ||||
'cost' => 0, | 'cost' => 0, | ||||
'units_free' => 0, | 'units_free' => 0, | ||||
'period' => 'monthly', | 'period' => 'monthly', | ||||
'handler_class' => 'App\Handlers\Files', | 'handler_class' => 'App\Handlers\Files', | ||||
'active' => true, | 'active' => true, | ||||
]); | ], | ||||
]; | |||||
foreach ($skus as $sku) { | |||||
// Check existence because migration might have added this already | |||||
if (!Sku::where('title', $sku['title'])->first()) { | |||||
Sku::create($sku); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } |