/** * Create a new profile from Github data. * * @param \League\OAuth2\Client\Provider\User $userDetails * @param \Tricks\User $user * @param string $token * @return \Tricks\Profile */ public function createFromGithubData(OAuthUser $details, User $user, $token) { $profile = $this->getNew(); $profile->uid = $details->uid; $profile->username = $details->nickname; $profile->name = $details->name; $profile->email = $details->email; $profile->first_name = $details->first_name; $profile->last_name = $details->last_name; $profile->location = $details->location; $profile->description = $details->description; $profile->image_url = $details->imageUrl; //$profile->urls = serialize($details->urls); $profile->access_token = $token; $profile = $user->profile()->save($profile); return $profile; }