<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Laravel\Socialite\Facades\Socialite;
class GoogleController extends Controller
{
public function redirectToGoogle()
{
return Socialite::driver('google')->redirect();
}
public function handleGoogleCallback()
{
$user = Socialite::driver('google')->user();
// You can now access the user's information using $user
// For example, $user->name, $user->email, $user->token, etc.
// Add your logic to authenticate or register the user here
return redirect()->route('home'); // Redirect to the desired page after authentication
}
}