daijiro of Techpit
3/12/2020 - 4:09 PM

LoginController.php

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
//==========ここから追加==========
use Laravel\Socialite\Facades\Socialite;
//==========ここまで追加==========

class LoginController extends Controller
{
    // 略
    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }
    
    //==========ここから追加==========
    public function redirectToProvider(string $provider)
    {
        return Socialite::driver($provider)->redirect();
    }
    //==========ここまで追加==========
}