Changeset View
Changeset View
Standalone View
Standalone View
src/database/seeds/local/PlanSeeder.php
Show All 9 Lines | |||||
{ | { | ||||
/** | /** | ||||
* Run the database seeds. | * Run the database seeds. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function run() | public function run() | ||||
{ | { | ||||
/* | $description = <<<'EOD' | ||||
$plan = Plan::create( | <p>Everything you need to get started or try Kolab Now, including:</p> | ||||
[ | <ul> | ||||
'title' => 'family', | <li>Perfect for anyone wanting to move to Kolab Now</li> | ||||
'description' => 'A group of accounts for 2 or more users.', | <li>Suite of online apps: Secure email, calendar, address book, files and more</li> | ||||
'discount_qty' => 0, | <li>Access for anywhere: Sync all your devices to your Kolab Now account</li> | ||||
'discount_rate' => 0 | <li>Secure hosting: Managed right here on our own servers in Switzerland </li> | ||||
] | <li>Start protecting your data today, no ads, no crawling, no compromise</li> | ||||
); | <li>An ideal replacement for services like Gmail, Office 365, etc…</li> | ||||
</ul> | |||||
$packages = [ | EOD; | ||||
Package::firstOrCreate(['title' => 'kolab']), | |||||
Package::firstOrCreate(['title' => 'domain-hosting']) | |||||
]; | |||||
$plan->packages()->saveMany($packages); | |||||
$plan->packages()->updateExistingPivot( | |||||
Package::firstOrCreate(['title' => 'kolab']), | |||||
[ | |||||
'qty_min' => 2, | |||||
'qty_max' => -1, | |||||
'discount_qty' => 2, | |||||
'discount_rate' => 50 | |||||
], | |||||
false | |||||
); | |||||
$plan = Plan::create( | $plan = Plan::create( | ||||
[ | [ | ||||
'title' => 'small-business', | 'title' => 'individual', | ||||
'description' => 'Accounts for small business owners.', | 'name' => 'Individual Account', | ||||
'description' => $description, | |||||
'discount_qty' => 0, | 'discount_qty' => 0, | ||||
'discount_rate' => 10 | 'discount_rate' => 0 | ||||
] | ] | ||||
); | ); | ||||
$packages = [ | $packages = [ | ||||
Package::firstOrCreate(['title' => 'kolab']), | Package::where(['title' => 'kolab', 'tenant_id' => \config('app.tenant_id')])->first() | ||||
Package::firstOrCreate(['title' => 'domain-hosting']) | |||||
]; | ]; | ||||
$plan->packages()->saveMany($packages); | $plan->packages()->saveMany($packages); | ||||
$plan->packages()->updateExistingPivot( | $description = <<<'EOD' | ||||
Package::firstOrCreate(['title' => 'kolab']), | <p>All the features of the Individual Account, with the following extras:</p> | ||||
[ | <ul> | ||||
'qty_min' => 5, | <li>Perfect for anyone wanting to move a group or small business to Kolab Now</li> | ||||
'qty_max' => 25, | <li>Recommended to support users from 1 to 100</li> | ||||
'discount_qty' => 5, | <li>Use your own personal domains with Kolab Now</li> | ||||
'discount_rate' => 30 | <li>Manage and add users through our online admin area</li> | ||||
], | <li>Flexible pricing based on user count</li> | ||||
false | </ul> | ||||
); | EOD; | ||||
$plan = Plan::create( | $plan = Plan::create( | ||||
[ | [ | ||||
'title' => 'large-business', | 'title' => 'group', | ||||
'description' => 'Accounts for large businesses.', | 'name' => 'Group Account', | ||||
'description' => $description, | |||||
'discount_qty' => 0, | 'discount_qty' => 0, | ||||
'discount_rate' => 10 | 'discount_rate' => 0 | ||||
] | ] | ||||
); | ); | ||||
$packages = [ | $packages = [ | ||||
Package::firstOrCreate(['title' => 'kolab']), | Package::where(['title' => 'domain-hosting', 'tenant_id' => \config('app.tenant_id')])->first(), | ||||
Package::firstOrCreate(['title' => 'lite']), | Package::where(['title' => 'kolab', 'tenant_id' => \config('app.tenant_id')])->first() | ||||
Package::firstOrCreate(['title' => 'domain-hosting']) | |||||
]; | ]; | ||||
$plan->packages()->saveMany($packages); | $plan->packages()->saveMany($packages); | ||||
$plan->packages()->updateExistingPivot( | // We're running in reseller mode, add a sample discount | ||||
Package::firstOrCreate(['title' => 'kolab']), | $tenants = \App\Tenant::where('id', '!=', \config('app.tenant_id'))->get(); | ||||
[ | |||||
'qty_min' => 20, | |||||
'qty_max' => -1, | |||||
'discount_qty' => 10, | |||||
'discount_rate' => 10 | |||||
], | |||||
false | |||||
); | |||||
$plan->packages()->updateExistingPivot( | |||||
Package::firstOrCreate(['title' => 'lite']), | |||||
[ | |||||
'qty_min' => 0, | |||||
'qty_max' => -1, | |||||
'discount_qty' => 10, | |||||
'discount_rate' => 10 | |||||
], | |||||
false | |||||
); | |||||
*/ | |||||
foreach ($tenants as $tenant) { | |||||
$description = <<<'EOD' | $description = <<<'EOD' | ||||
<p>Everything you need to get started or try Kolab Now, including:</p> | <p>Everything you need to get started or try Kolab Now, including:</p> | ||||
<ul> | <ul> | ||||
<li>Perfect for anyone wanting to move to Kolab Now</li> | <li>Perfect for anyone wanting to move to Kolab Now</li> | ||||
<li>Suite of online apps: Secure email, calendar, address book, files and more</li> | <li>Suite of online apps: Secure email, calendar, address book, files and more</li> | ||||
<li>Access for anywhere: Sync all your devices to your Kolab Now account</li> | <li>Access for anywhere: Sync all your devices to your Kolab Now account</li> | ||||
<li>Secure hosting: Managed right here on our own servers in Switzerland </li> | <li>Secure hosting: Managed right here on our own servers in Switzerland </li> | ||||
<li>Start protecting your data today, no ads, no crawling, no compromise</li> | <li>Start protecting your data today, no ads, no crawling, no compromise</li> | ||||
<li>An ideal replacement for services like Gmail, Office 365, etc…</li> | <li>An ideal replacement for services like Gmail, Office 365, etc…</li> | ||||
</ul> | </ul> | ||||
EOD; | EOD; | ||||
$plan = Plan::create( | $plan = Plan::create( | ||||
[ | [ | ||||
'title' => 'individual', | 'title' => 'individual', | ||||
'name' => 'Individual Account', | 'name' => 'Individual Account', | ||||
'description' => $description, | 'description' => $description, | ||||
'discount_qty' => 0, | 'discount_qty' => 0, | ||||
'discount_rate' => 0 | 'discount_rate' => 0 | ||||
] | ] | ||||
); | ); | ||||
$plan->tenant_id = $tenant->id; | |||||
$plan->save(); | |||||
$packages = [ | $packages = [ | ||||
Package::firstOrCreate(['title' => 'kolab']) | Package::where(['title' => 'kolab', 'tenant_id' => $tenant->id])->first() | ||||
]; | ]; | ||||
$plan->packages()->saveMany($packages); | $plan->packages()->saveMany($packages); | ||||
$description = <<<'EOD' | $description = <<<'EOD' | ||||
<p>All the features of the Individual Account, with the following extras:</p> | <p>All the features of the Individual Account, with the following extras:</p> | ||||
<ul> | <ul> | ||||
<li>Perfect for anyone wanting to move a group or small business to Kolab Now</li> | <li>Perfect for anyone wanting to move a group or small business to Kolab Now</li> | ||||
<li>Recommended to support users from 1 to 100</li> | <li>Recommended to support users from 1 to 100</li> | ||||
<li>Use your own personal domains with Kolab Now</li> | <li>Use your own personal domains with Kolab Now</li> | ||||
<li>Manage and add users through our online admin area</li> | <li>Manage and add users through our online admin area</li> | ||||
<li>Flexible pricing based on user count</li> | <li>Flexible pricing based on user count</li> | ||||
</ul> | </ul> | ||||
EOD; | EOD; | ||||
$plan = Plan::create( | $plan = Plan::create( | ||||
[ | [ | ||||
'title' => 'group', | 'title' => 'group', | ||||
'name' => 'Group Account', | 'name' => 'Group Account', | ||||
'description' => $description, | 'description' => $description, | ||||
'discount_qty' => 0, | 'discount_qty' => 0, | ||||
'discount_rate' => 0 | 'discount_rate' => 0 | ||||
] | ] | ||||
); | ); | ||||
$plan->tenant_id = $tenant->id; | |||||
$plan->save(); | |||||
$packages = [ | $packages = [ | ||||
Package::firstOrCreate(['title' => 'domain-hosting']), | Package::where(['title' => 'domain-hosting', 'tenant_id' => $tenant->id])->first(), | ||||
Package::firstOrCreate(['title' => 'kolab']), | Package::where(['title' => 'kolab', 'tenant_id' => $tenant->id])->first() | ||||
]; | ]; | ||||
$plan->packages()->saveMany($packages); | $plan->packages()->saveMany($packages); | ||||
} | } | ||||
} | } | ||||
} |