Last active
March 12, 2018 17:51
-
-
Save lancepioch/1a80fe52f5b93fb3a57e to your computer and use it in GitHub Desktop.
HW
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UserTableSeeder extends Seeder { | |
public function run() | |
{ | |
$now = Carbon::now('utc')->toDateTimeString(); | |
DB::table('steams')->delete(); | |
DB::table('users')->delete(); | |
$group = new Group(config('services.steam.api'), config('services.steam.group')); | |
$members = $group->getMembers(); | |
foreach ($members as $member) { | |
$user = new User(['name' => null, 'created_at' => $now, 'updated_at' => $now]); | |
$user->save(); | |
$steam = new Steam([ | |
'name' => $member->personaname, | |
'avatar' => $member->avatarfull, | |
'steam_id' => $member->steamid, | |
'last_logoff' => $member->lastlogoff, | |
'created_at' => $now, | |
'updated_at' => $now, | |
]); | |
$steam->user()->associate($user); | |
$steam->save(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment