Changeset View
Changeset View
Standalone View
Standalone View
src/database/seeds/UserSeeder.php
<?php | <?php | ||||
use Illuminate\Database\Seeder; | |||||
use App\Domain; | use App\Domain; | ||||
use App\Entitlement; | use App\Entitlement; | ||||
use App\User; | use App\User; | ||||
use App\Sku; | use App\Sku; | ||||
use Carbon\Carbon; | |||||
use Illuminate\Database\Seeder; | |||||
// phpcs:ignore | // phpcs:ignore | ||||
class UserSeeder extends Seeder | class UserSeeder extends Seeder | ||||
{ | { | ||||
/** | /** | ||||
* Run the database seeds. | * Run the database seeds. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function run() | public function run() | ||||
{ | { | ||||
$domain = Domain::create( | $domain = Domain::create( | ||||
[ | [ | ||||
'namespace' => 'kolab.org', | 'namespace' => 'kolab.org', | ||||
'status' => Domain::STATUS_NEW + Domain::STATUS_ACTIVE + Domain::STATUS_CONFIRMED + Domain::STATUS_VERIFIED, | 'status' => Domain::STATUS_NEW | ||||
+ Domain::STATUS_ACTIVE | |||||
+ Domain::STATUS_CONFIRMED | |||||
+ Domain::STATUS_VERIFIED, | |||||
'type' => Domain::TYPE_EXTERNAL | 'type' => Domain::TYPE_EXTERNAL | ||||
] | ] | ||||
); | ); | ||||
$john = User::create( | $john = User::create( | ||||
[ | [ | ||||
'name' => 'John Doe', | 'name' => 'John Doe', | ||||
'email' => 'john@kolab.org', | 'email' => 'john@kolab.org', | ||||
Show All 11 Lines | public function run() | ||||
'billing_address' => "601 13th Street NW\nSuite 900 South\nWashington, DC 20005", | 'billing_address' => "601 13th Street NW\nSuite 900 South\nWashington, DC 20005", | ||||
'external_email' => 'john.doe.external@gmail.com', | 'external_email' => 'john.doe.external@gmail.com', | ||||
'phone' => '+1 509-248-1111', | 'phone' => '+1 509-248-1111', | ||||
] | ] | ||||
); | ); | ||||
$john->setAliases(['john.doe@kolab.org']); | $john->setAliases(['john.doe@kolab.org']); | ||||
$user_wallets = $john->wallets()->get(); | $wallet = $john->wallets->first(); | ||||
$package_domain = \App\Package::where('title', 'domain-hosting')->first(); | $package_domain = \App\Package::where('title', 'domain-hosting')->first(); | ||||
$package_kolab = \App\Package::where('title', 'kolab')->first(); | $package_kolab = \App\Package::where('title', 'kolab')->first(); | ||||
$domain->assignPackage($package_domain, $john); | $domain->assignPackage($package_domain, $john); | ||||
$john->assignPackage($package_kolab); | $john->assignPackage($package_kolab); | ||||
$jack = User::create( | $jack = User::create( | ||||
Show All 13 Lines | public function run() | ||||
'country' => 'US' | 'country' => 'US' | ||||
] | ] | ||||
); | ); | ||||
$jack->setAliases(['jack.daniels@kolab.org']); | $jack->setAliases(['jack.daniels@kolab.org']); | ||||
$john->assignPackage($package_kolab, $jack); | $john->assignPackage($package_kolab, $jack); | ||||
foreach ($john->entitlements as $entitlement) { | |||||
$entitlement->created_at = Carbon::now()->subMonths(1); | |||||
$entitlement->updated_at = Carbon::now()->subMonths(1); | |||||
$entitlement->save(); | |||||
} | |||||
factory(User::class, 10)->create(); | factory(User::class, 10)->create(); | ||||
} | } | ||||
} | } |