Skip to content

Commit 95f9c45

Browse files
committed
WIP
1 parent 9c70549 commit 95f9c45

3 files changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('users', function (Blueprint $table) {
15+
$table->after('provider_name', function (Blueprint $table) {
16+
$table->string('provider_access_token')->nullable();
17+
$table->string('provider_refresh_token')->nullable();
18+
});
19+
});
20+
}
21+
22+
/**
23+
* Reverse the migrations.
24+
*/
25+
public function down(): void
26+
{
27+
Schema::table('users', function (Blueprint $table) {
28+
$table->dropColumn([
29+
'provider_access_token',
30+
'provider_refresh_token',
31+
]);
32+
});
33+
}
34+
};

src/BartenderServiceProvider.php

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function boot(): void
2424
{
2525
$this->publishes([
2626
__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'),
27+
__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'),
2728
], 'bartender-migrations');
2829
}
2930

src/UserProviderRepository.php

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public function updateOrCreate(string $driver, SocialiteUser $user): Authenticat
4747
array_merge([
4848
'name' => $user->name,
4949
'provider_id' => $user->id,
50+
'provider_access_token' => $user->token,
51+
'provider_refresh_token' => $user->refreshToken,
5052
'password' => $eloquent->password ?? $this->hash($this->getNewPassword()),
5153
],
5254
$this->isUsingSoftDeletes($model)

0 commit comments

Comments
 (0)