app/Http/Controllers/Auth/LoginController.php
/**
     * Obtain the user information from GitHub.
     *
     * @return \Illuminate\Http\Response
     */
Obtain the user information from GitHub.
@return \Illuminate\Http\Response
Obtain the user information from GitHub . @return \ Illuminate \ Http \ Response
public function handleProviderCallback()
    {
        $prov = Input::get('provider');
        dd($prov);
        $githubUser = Socialite::driver('github')->user();
        $user = User::where('provider_id', $githubUser['id'])->first();
        if(!$user){
            $user = User::create([
                'name' => $githubUser['name'],
                'email' => $githubUser['email'],
                'provider_id' => $githubUser['id'],
            ]);
        }
        Auth::login($user, true);
        return redirect($this->redirectTo);
    }
public function handleProviderCallback ( ) { $ prov = Input :: get ( 'provider' ) ; dd ( $ prov ) ; $ githubUser = Socialite :: driver ( 'github' ) -> user ( ) ; $ user = User :: where ( 'provider_id' , $ githubUser [ 'id' ] ) -> first ( ) ; if ( ! $ user ) { $ user = User :: create ( [ 'name' => $ githubUser [ 'name' ] , 'email' => $ githubUser [ 'email' ] , 'provider_id' => $ githubUser [ 'id' ] , ] ) ; } Auth :: login ( $ user , true ) ; return redirect ( $ this -> redirectTo ) ; }
Obtain the user information from GitHub.
Obtain the user information from GitHub .
//add user to database //login the user