Skip to content

Commit

Permalink
Merge pull request #9 from DirectoryTree/force-fill
Browse files Browse the repository at this point in the history
Force fill attributes to bypass guarded attributes
  • Loading branch information
stevebauman authored May 29, 2024
2 parents 8f17546 + 52f960f commit c540aed
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/UserProviderRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ public function updateOrCreate(string $driver, SocialiteUser $user): Authenticat
{
$model = Bartender::getUserModel();

$eloquent = $this->newUserQuery($model)->firstOrNew([
$eloquent = $this->newUserQuery($model)->firstWhere([
'email' => $user->email,
'provider_name' => $driver,
]) ?? (new $model)->forceFill([
'email' => $user->email,
'provider_name' => $driver,
]);

$eloquent->fill(
$eloquent->forceFill(
array_merge([
'name' => $user->name,
'provider_id' => $user->id,
Expand Down

0 comments on commit c540aed

Please sign in to comment.