Changeset View
Changeset View
Standalone View
Standalone View
src/database/seeds/local/DiscountSeeder.php
Show All 20 Lines | public function run() | ||||
'active' => true, | 'active' => true, | ||||
] | ] | ||||
); | ); | ||||
Discount::create( | Discount::create( | ||||
[ | [ | ||||
'description' => 'Student or Educational Institution', | 'description' => 'Student or Educational Institution', | ||||
'discount' => 30, | 'discount' => 30, | ||||
'active' => true, | 'active' => true, | ||||
machniak: Really, I like these commas. It makes the diff simpler if you add another entry to the array… | |||||
] | ] | ||||
); | ); | ||||
Discount::create( | Discount::create( | ||||
[ | [ | ||||
'description' => 'Test voucher', | 'description' => 'Test voucher', | ||||
'discount' => 10, | 'discount' => 10, | ||||
'active' => true, | 'active' => true, | ||||
'code' => 'TEST', | 'code' => 'TEST', | ||||
] | ] | ||||
); | ); | ||||
// We're running in reseller mode, add a sample discount | |||||
$tenants = \App\Tenant::where('id', '!=', \config('app.tenant_id'))->get(); | |||||
foreach ($tenants as $tenant) { | |||||
$discount = Discount::create( | |||||
[ | |||||
'description' => "Sample Discount by Reseller '{$tenant->title}'", | |||||
'discount' => 10, | |||||
'active' => true, | |||||
] | |||||
); | |||||
$discount->tenant_id = $tenant->id; | |||||
$discount->save(); | |||||
} | |||||
} | } | ||||
} | } |
Really, I like these commas. It makes the diff simpler if you add another entry to the array later.