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()
    {
        $user = collect(Socialite::driver('github')->stateless()->user())->only([
          'token', 'name', 'avatar', 'id'
        ]);
        $dbUser = User::firstOrCreate(['github_id' => $user['id']],[
            'eid' => Hashids::encode(floor(Carbon::now()->timestamp / 2) . $user['id'] . rand(0, 10)),
        ]);
        $subscriptions = $dbUser->pushSubscriptions;
        return new UserResource($user->merge($dbUser)->merge(['subscriptions' => $subscriptions]));
    }
public function handleProviderCallback ( ) { $ user = collect ( Socialite :: driver ( 'github' ) -> stateless ( ) -> user ( ) ) -> only ( [ 'token' , 'name' , 'avatar' , 'id' ] ) ; $ dbUser = User :: firstOrCreate ( [ 'github_id' => $ user [ 'id' ] ] , [ 'eid' => Hashids :: encode ( floor ( Carbon :: now ( ) -> timestamp / 2 ) . $ user [ 'id' ] . rand ( 0 , 10 ) ) , ] ) ; $ subscriptions = $ dbUser -> pushSubscriptions ; return new UserResource ( $ user -> merge ( $ dbUser ) -> merge ( [ 'subscriptions' => $ subscriptions ] ) ) ; }
Obtain the user information from GitHub.
Obtain the user information from GitHub .