Laravel 社会名流请求 Returns 空

Laravel Socialite Request Returns Null

我正在使用 Laravel Socialite 5.0。

<?php

use Illuminate\Http\Request;

public function login(AuthenticateUser $authenticateUser, Request $request){
    return $authenticateUser->execute($request->has('code'));
}

$request->has('code') 始终 returns 为空。这是为什么? 提供我的 AuthenticateUser class 我认为这是一个 redirect/request 问题。

<?php 

namespace App;

use Laravel\Socialite\Contracts\Factory as Socialite;
use Illuminate\Contracts\Auth\Guard as Guard;
use App\Repositories\UserRepository as UserRepository;
use Log;

class AuthenticateUser {

    private $users;
    private $socialite;
    private $auth;

    public function __construct (UserRepository $users, Socialite $socialite, Guard $auth) {
        $this->users = $users;
        $this->socialite = $socialite;
        $this->auth = $auth;
    }

    public function execute ($hasCode) {
        if( ! $hasCode){
            Log::info('1');
            return $this->getAuthorizationFirst();
        }
        Log::info('2');
        $user = $this->socialite->driver('github')->user();
    }

    public function getAuthorizationFirst(){
        return $this->socialite->driver('github')->redirect();
    }

}

添加 AuthController Class 以供参考:

class AuthController extends Controller {

    /*
    |--------------------------------------------------------------------------
    | Registration & Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users, as well as the
    | authentication of existing users. By default, this controller uses
    | a simple trait to add these behaviors. Why don't you explore it?
    |
    */

    use AuthenticatesAndRegistersUsers;

    /**
     * Create a new authentication controller instance.
     *
     * @param  \Illuminate\Contracts\Auth\Guard  $auth
     * @param  \Illuminate\Contracts\Auth\Registrar  $registrar
     * @return void
     */
    public function __construct(Guard $auth, Registrar $registrar)
    {
        $this->auth = $auth;
        $this->registrar = $registrar;

        $this->middleware('guest', ['except' => 'getLogout']);
    }

    public function login(AuthenticateUser $authenticateUser, Request $request){
        Log::info('_'.$request->has('code').'_');
        return $authenticateUser->execute($request->has('code'));
    }

}

问题出在 return url 路线上! 我 return 从应用程序转到了错误的路线。