blog-google-calendar icon indicating copy to clipboard operation
blog-google-calendar copied to clipboard

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

Open yadavsingh opened this issue 4 years ago • 1 comments

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');
}

yadavsingh avatar Nov 04 '20 06:11 yadavsingh

'name' => $account->email,

imnpc avatar Nov 09 '21 03:11 imnpc