Skip to content

Commit

Permalink
Adding updates to allow the socialite user to use a custom model
Browse files Browse the repository at this point in the history
  • Loading branch information
tnylea committed Oct 25, 2024
1 parent ae99803 commit e54ce09
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Http/Controllers/SocialController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Devdojo\Auth\Models\SocialProvider;
use Devdojo\Auth\Models\SocialProviderUser;
use Devdojo\Auth\Models\User;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
Expand Down Expand Up @@ -76,7 +75,7 @@ private function findOrCreateProviderUser($socialiteUser, $driver)
return $providerUser;
}

$user = User::where('email', $socialiteUser->getEmail())->first();
$user = app(config('auth.providers.users.model'))->where('email', $socialiteUser->getEmail())->first();

if ($user) {
$existingProvider = $user->socialProviders()->first();
Expand All @@ -95,7 +94,7 @@ private function findOrCreateProviderUser($socialiteUser, $driver)

private function createUser($socialiteUser)
{
return User::create([
return app(config('auth.providers.users.model'))->create([
'name' => $socialiteUser->getName(),
'email' => $socialiteUser->getEmail(),
'email_verified_at' => now(),
Expand Down

0 comments on commit e54ce09

Please sign in to comment.