public function handleProviderCallback(Request $request, string $provider)
    {
        $providerUser = Socialite::driver($provider)->user();
        $fullName = explode(' ', $providerUser->name);

        $attributes = [
            'id' => $providerUser->id,
            'email' => $providerUser->email,
            'username' => $providerUser->nickname ?? trim(mb_strstr($providerUser->email, '@', true)),
            'given_name' => current($fullName),
            'family_name' => end($fullName),
        ];

        switch ($provider) {
            case 'twitter':
                $attributes['title'] = $providerUser->user['description'];
                $attributes['profile_picture'] = $providerUser->avatar_original;
                break;
            case 'github':
                $attributes['title'] = $providerUser->user['bio'];
                $attributes['profile_picture'] = $providerUser->avatar;
                break;
            case 'facebook':
                $attributes['profile_picture'] = $providerUser->avatar_original;
                break;
            case 'linkedin':
                $attributes['title'] = $providerUser->headline;
                $attributes['profile_picture'] = $providerUser->avatar_original;
                break;
            case 'google':
                $attributes['title'] = $providerUser->tagline;
                $attributes['profile_picture'] = $providerUser->avatar_original;
                break;
        }

        if (! ($localUser = $this->getLocalUser($provider, $providerUser->id))) {
            $localUser = $this->createLocalUser($provider, $attributes);
        }

        auth()->guard($this->getGuard())->login($localUser, true);

        return intend([
            'intended' => route('adminarea.home'),
            'with' => ['success' => trans('cortex/auth::messages.auth.login')],
        ]);
    }