return Socialite::driver('facebook')->redirect();
这会将传入的请求重定向到要验证的适当URL。一个基本的例子是在控制器中
<?php namespace App\Http\Controllers\Auth; use Socialite; class AuthenticationController extends Controller { /** * Redirects the User to the Facebook page to get authorization. * * @return Response */ public function facebook() { return Socialite::driver('facebook')->redirect(); } }
确保您的app\Http\routes.php文件具有在此处允许传入请求的路由。
Route::get('facebook', 'App\Http\Controllers\Auth\AuthenticationController@facebook');