Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset() expects parameter 1 to be array, string given #6

Open
yadavsingh opened this issue Nov 4, 2020 · 1 comment
Open

reset() expects parameter 1 to be array, string given #6

yadavsingh opened this issue Nov 4, 2020 · 1 comment

Comments

@yadavsingh
Copy link

Issue appear on this line:
'name' => head($account->email)->value,

public function store(Request $request, Google $google)
{
if (! $request->has('code')) {
return redirect($google->createAuthUrl());
}

	// Use the given code to authenticate the user.
	$google->authenticate($request->get('code'));

	// Make a call to the Google+ API to get more information on the account.
	$account = $google->service('Oauth2')->userinfo->get();

	auth()->user()->googleAccounts()->updateOrCreate(
		[
			// Map the account's id to the `google_id`.
			'google_id' => $account->id,
		],
		[
			// Use the first email address as the Google account's name.
			'name' => head($account->email)->value,

			// Last but not least, save the access token for later use.
			'token' => $google->getAccessToken(),
		]
	);

	return redirect()->route('google.index');
}
@imnpc
Copy link

imnpc commented Nov 9, 2021

'name' => $account->email,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants