diff --git a/database/seeders/DemoSeeder.php b/database/seeders/DemoSeeder.php index 9ae57e90..f2b8d5cb 100644 --- a/database/seeders/DemoSeeder.php +++ b/database/seeders/DemoSeeder.php @@ -16,19 +16,20 @@ class DemoSeeder extends Seeder */ public function run() { - User::create([ + $user = User::create([ 'name' => 'demo', 'email' => 'demo@2fauth.app', 'password' => bcrypt('demo'), 'is_admin' => 1, ]); - $groupSocialNetwork = Group::create([ + $groupSocialNetwork = $user->groups()->create([ 'name' => 'Social Networks', ]); - $groupSocialNetwork->twofaccounts()->createMany([ + $user->twofaccounts()->createMany([ [ + 'group_id' => $groupSocialNetwork->id, 'otp_type' => 'totp', 'account' => 'johndoe@facebook.com', 'service' => 'Facebook', @@ -40,6 +41,7 @@ public function run() 'legacy_uri' => 'otpauth://totp/Facebook:johndoe@facebook.com?secret=A4GRFTVVRBGY7UIW', ], [ + 'group_id' => $groupSocialNetwork->id, 'otp_type' => 'totp', 'service' => 'Twitter', 'account' => '@john', @@ -51,6 +53,7 @@ public function run() 'legacy_uri' => 'otpauth://totp/Twitter:@john?secret=A2GRFTVVRBGY7UIW', ], [ + 'group_id' => $groupSocialNetwork->id, 'otp_type' => 'totp', 'service' => 'Instagram', 'account' => '@johndoe', @@ -62,6 +65,7 @@ public function run() 'legacy_uri' => 'otpauth://totp/Instagram:@johndoe?secret=A6GRFTVVRBGY7UIW', ], [ + 'group_id' => $groupSocialNetwork->id, 'otp_type' => 'totp', 'service' => 'LinkedIn', 'account' => '@johndoe', @@ -74,11 +78,12 @@ public function run() ] ]); - $groupECommerce = Group::create([ + $groupECommerce = $user->groups()->create([ 'name' => 'eCommerce', ]); - $groupECommerce->twofaccounts()->create([ + $user->twofaccounts()->create([ + 'group_id' => $groupECommerce->id, 'otp_type' => 'totp', 'account' => 'johndoe', 'service' => 'Amazon', @@ -90,52 +95,51 @@ public function run() 'legacy_uri' => 'otpauth://totp/Amazon:johndoe?secret=A7GRFTVVRBGY7UIW', ]); - TwoFAccount::create([ - 'otp_type' => 'totp', - 'account' => 'john.doe@icloud.com', - 'service' => 'Apple', - 'secret' => 'A2GRFTVVRBGY7UIW', - 'algorithm' => 'sha1', - 'digits' => 6, - 'period' => 30, - 'icon' => 'apple.png', - 'legacy_uri' => 'otpauth://totp/Apple:john.doe@icloud.com?secret=A2GRFTVVRBGY7UIW', - ]); - - TwoFAccount::create([ - 'otp_type' => 'totp', - 'account' => 'john.doe', - 'service' => 'Dropbox', - 'secret' => 'A3GRFTVVRBGY7UIW', - 'algorithm' => 'sha1', - 'digits' => 6, - 'period' => 30, - 'icon' => 'dropbox.png', - 'legacy_uri' => 'otpauth://totp/Dropbox:john.doe?secret=A3GRFTVVRBGY7UIW', - ]); - - TwoFAccount::create([ - 'otp_type' => 'totp', - 'account' => '@john', - 'service' => 'Github', - 'secret' => 'A2GRFTVVRBGY7UIW', - 'algorithm' => 'sha1', - 'digits' => 6, - 'period' => 30, - 'icon' => 'github.png', - 'legacy_uri' => 'otpauth://totp/Github:@john?secret=A2GRFTVVRBGY7UIW', - ]); - - TwoFAccount::create([ - 'otp_type' => 'totp', - 'service' => 'Google', - 'account' => 'john.doe@gmail.com', - 'secret' => 'A5GRFTVVRBGY7UIW', - 'algorithm' => 'sha1', - 'digits' => 6, - 'period' => 30, - 'icon' => 'google.png', - 'legacy_uri' => 'otpauth://totp/Google:john.doe@gmail.com?secret=A5GRFTVVRBGY7UIW', + $user->twofaccounts()->createMany([ + [ + 'otp_type' => 'totp', + 'account' => 'john.doe@icloud.com', + 'service' => 'Apple', + 'secret' => 'A2GRFTVVRBGY7UIW', + 'algorithm' => 'sha1', + 'digits' => 6, + 'period' => 30, + 'icon' => 'apple.png', + 'legacy_uri' => 'otpauth://totp/Apple:john.doe@icloud.com?secret=A2GRFTVVRBGY7UIW', + ], + [ + 'otp_type' => 'totp', + 'account' => 'john.doe', + 'service' => 'Dropbox', + 'secret' => 'A3GRFTVVRBGY7UIW', + 'algorithm' => 'sha1', + 'digits' => 6, + 'period' => 30, + 'icon' => 'dropbox.png', + 'legacy_uri' => 'otpauth://totp/Dropbox:john.doe?secret=A3GRFTVVRBGY7UIW', + ], + [ + 'otp_type' => 'totp', + 'account' => '@john', + 'service' => 'Github', + 'secret' => 'A2GRFTVVRBGY7UIW', + 'algorithm' => 'sha1', + 'digits' => 6, + 'period' => 30, + 'icon' => 'github.png', + 'legacy_uri' => 'otpauth://totp/Github:@john?secret=A2GRFTVVRBGY7UIW', + ], + [ + 'otp_type' => 'totp', + 'service' => 'Google', + 'account' => 'john.doe@gmail.com', + 'secret' => 'A5GRFTVVRBGY7UIW', + 'algorithm' => 'sha1', + 'digits' => 6, + 'period' => 30, + 'icon' => 'google.png', + 'legacy_uri' => 'otpauth://totp/Google:john.doe@gmail.com?secret=A5GRFTVVRBGY7UIW', + ] ]); } }