Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Oct 27, 2024
1 parent 9c70549 commit 95f9c45
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->after('provider_name', function (Blueprint $table) {
$table->string('provider_access_token')->nullable();
$table->string('provider_refresh_token')->nullable();
});
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn([
'provider_access_token',
'provider_refresh_token',
]);
});
}
};
1 change: 1 addition & 0 deletions src/BartenderServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function boot(): void
{
$this->publishes([
__DIR__.'/../database/migrations/2024_03_31_000001_add_provider_columns_to_users_table.php' => database_path('migrations/2024_03_31_000001_add_provider_columns_to_users_table.php'),
__DIR__.'/../database/migrations/2024_10_27_131354_add_provider_token_columns_to_users_table.php' => database_path('migrations/2024_10_27_131354_add_provider_token_columns_to_users_table.php'),
], 'bartender-migrations');
}

Expand Down
2 changes: 2 additions & 0 deletions src/UserProviderRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public function updateOrCreate(string $driver, SocialiteUser $user): Authenticat
array_merge([
'name' => $user->name,
'provider_id' => $user->id,
'provider_access_token' => $user->token,
'provider_refresh_token' => $user->refreshToken,
'password' => $eloquent->password ?? $this->hash($this->getNewPassword()),
],
$this->isUsingSoftDeletes($model)
Expand Down

0 comments on commit 95f9c45

Please sign in to comment.