Changeset View
Changeset View
Standalone View
Standalone View
src/database/seeds/production/PackageSeeder.php
Show All 9 Lines | |||||
{ | { | ||||
/** | /** | ||||
* Run the database seeds. | * Run the database seeds. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function run() | public function run() | ||||
{ | { | ||||
$skuActiveSync = Sku::firstOrCreate(['title' => 'activesync']); | |||||
$skuGroupware = Sku::firstOrCreate(['title' => 'groupware']); | $skuGroupware = Sku::firstOrCreate(['title' => 'groupware']); | ||||
$skuMailbox = Sku::firstOrCreate(['title' => 'mailbox']); | $skuMailbox = Sku::firstOrCreate(['title' => 'mailbox']); | ||||
$skuStorage = Sku::firstOrCreate(['title' => 'storage']); | $skuStorage = Sku::firstOrCreate(['title' => 'storage']); | ||||
$package = Package::create( | $package = Package::create( | ||||
[ | [ | ||||
'title' => 'kolab', | 'title' => 'kolab', | ||||
'name' => 'Groupware Account', | 'name' => 'Groupware Account', | ||||
'description' => 'A fully functional groupware account.', | 'description' => 'A fully functional groupware account.', | ||||
'discount_rate' => 0 | 'discount_rate' => 0 | ||||
] | ] | ||||
); | ); | ||||
$skus = [ | $skus = [ | ||||
$skuMailbox, | $skuMailbox, | ||||
$skuGroupware, | $skuGroupware, | ||||
$skuStorage | $skuStorage, | ||||
$skuActiveSync | |||||
]; | ]; | ||||
$package->skus()->saveMany($skus); | $package->skus()->saveMany($skus); | ||||
// This package contains 2 units of the storage SKU, which just so happens to also | // This package contains 2 units of the storage SKU, which just so happens to also | ||||
// be the number of SKU free units. | // be the number of SKU free units. | ||||
$package->skus()->updateExistingPivot( | $package->skus()->updateExistingPivot( | ||||
$skuStorage, | $skuStorage, | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |