Skip to content

Commit fb95081

Browse files
authored
Revert model DB connection customization (#1412)
1 parent 3e10037 commit fb95081

12 files changed

+10
-214
lines changed

config/passport.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,4 @@
4646
'secret' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET'),
4747
],
4848

49-
/*
50-
|--------------------------------------------------------------------------
51-
| Passport Storage Driver
52-
|--------------------------------------------------------------------------
53-
|
54-
| This configuration value allows you to customize the storage options
55-
| for Passport, such as the database connection that should be used
56-
| by Passport's internal database models which store tokens, etc.
57-
|
58-
*/
59-
60-
'storage' => [
61-
'database' => [
62-
'connection' => env('DB_CONNECTION', 'mysql'),
63-
],
64-
],
65-
6649
];

database/migrations/2016_06_01_000001_create_oauth_auth_codes_table.php

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,14 @@
66

77
class CreateOauthAuthCodesTable extends Migration
88
{
9-
/**
10-
* The database schema.
11-
*
12-
* @var \Illuminate\Database\Schema\Builder
13-
*/
14-
protected $schema;
15-
16-
/**
17-
* Create a new migration instance.
18-
*
19-
* @return void
20-
*/
21-
public function __construct()
22-
{
23-
$this->schema = Schema::connection($this->getConnection());
24-
}
25-
269
/**
2710
* Run the migrations.
2811
*
2912
* @return void
3013
*/
3114
public function up()
3215
{
33-
$this->schema->create('oauth_auth_codes', function (Blueprint $table) {
16+
Schema::create('oauth_auth_codes', function (Blueprint $table) {
3417
$table->string('id', 100)->primary();
3518
$table->unsignedBigInteger('user_id')->index();
3619
$table->unsignedBigInteger('client_id');
@@ -47,16 +30,6 @@ public function up()
4730
*/
4831
public function down()
4932
{
50-
$this->schema->dropIfExists('oauth_auth_codes');
51-
}
52-
53-
/**
54-
* Get the migration connection name.
55-
*
56-
* @return string|null
57-
*/
58-
public function getConnection()
59-
{
60-
return config('passport.storage.database.connection');
33+
Schema::dropIfExists('oauth_auth_codes');
6134
}
6235
}

database/migrations/2016_06_01_000002_create_oauth_access_tokens_table.php

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,14 @@
66

77
class CreateOauthAccessTokensTable extends Migration
88
{
9-
/**
10-
* The database schema.
11-
*
12-
* @var \Illuminate\Database\Schema\Builder
13-
*/
14-
protected $schema;
15-
16-
/**
17-
* Create a new migration instance.
18-
*
19-
* @return void
20-
*/
21-
public function __construct()
22-
{
23-
$this->schema = Schema::connection($this->getConnection());
24-
}
25-
269
/**
2710
* Run the migrations.
2811
*
2912
* @return void
3013
*/
3114
public function up()
3215
{
33-
$this->schema->create('oauth_access_tokens', function (Blueprint $table) {
16+
Schema::create('oauth_access_tokens', function (Blueprint $table) {
3417
$table->string('id', 100)->primary();
3518
$table->unsignedBigInteger('user_id')->nullable()->index();
3619
$table->unsignedBigInteger('client_id');
@@ -49,16 +32,6 @@ public function up()
4932
*/
5033
public function down()
5134
{
52-
$this->schema->dropIfExists('oauth_access_tokens');
53-
}
54-
55-
/**
56-
* Get the migration connection name.
57-
*
58-
* @return string|null
59-
*/
60-
public function getConnection()
61-
{
62-
return config('passport.storage.database.connection');
35+
Schema::dropIfExists('oauth_access_tokens');
6336
}
6437
}

database/migrations/2016_06_01_000003_create_oauth_refresh_tokens_table.php

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,14 @@
66

77
class CreateOauthRefreshTokensTable extends Migration
88
{
9-
/**
10-
* The database schema.
11-
*
12-
* @var \Illuminate\Database\Schema\Builder
13-
*/
14-
protected $schema;
15-
16-
/**
17-
* Create a new migration instance.
18-
*
19-
* @return void
20-
*/
21-
public function __construct()
22-
{
23-
$this->schema = Schema::connection($this->getConnection());
24-
}
25-
269
/**
2710
* Run the migrations.
2811
*
2912
* @return void
3013
*/
3114
public function up()
3215
{
33-
$this->schema->create('oauth_refresh_tokens', function (Blueprint $table) {
16+
Schema::create('oauth_refresh_tokens', function (Blueprint $table) {
3417
$table->string('id', 100)->primary();
3518
$table->string('access_token_id', 100)->index();
3619
$table->boolean('revoked');
@@ -45,16 +28,6 @@ public function up()
4528
*/
4629
public function down()
4730
{
48-
$this->schema->dropIfExists('oauth_refresh_tokens');
49-
}
50-
51-
/**
52-
* Get the migration connection name.
53-
*
54-
* @return string|null
55-
*/
56-
public function getConnection()
57-
{
58-
return config('passport.storage.database.connection');
31+
Schema::dropIfExists('oauth_refresh_tokens');
5932
}
6033
}

database/migrations/2016_06_01_000004_create_oauth_clients_table.php

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,14 @@
66

77
class CreateOauthClientsTable extends Migration
88
{
9-
/**
10-
* The database schema.
11-
*
12-
* @var \Illuminate\Database\Schema\Builder
13-
*/
14-
protected $schema;
15-
16-
/**
17-
* Create a new migration instance.
18-
*
19-
* @return void
20-
*/
21-
public function __construct()
22-
{
23-
$this->schema = Schema::connection($this->getConnection());
24-
}
25-
26-
/**
27-
* Get the migration connection name.
28-
*
29-
* @return string|null
30-
*/
31-
public function getConnection()
32-
{
33-
return config('passport.storage.database.connection');
34-
}
35-
369
/**
3710
* Run the migrations.
3811
*
3912
* @return void
4013
*/
4114
public function up()
4215
{
43-
$this->schema->create('oauth_clients', function (Blueprint $table) {
16+
Schema::create('oauth_clients', function (Blueprint $table) {
4417
$table->bigIncrements('id');
4518
$table->unsignedBigInteger('user_id')->nullable()->index();
4619
$table->string('name');
@@ -61,6 +34,6 @@ public function up()
6134
*/
6235
public function down()
6336
{
64-
$this->schema->dropIfExists('oauth_clients');
37+
Schema::dropIfExists('oauth_clients');
6538
}
6639
}

database/migrations/2016_06_01_000005_create_oauth_personal_access_clients_table.php

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,14 @@
66

77
class CreateOauthPersonalAccessClientsTable extends Migration
88
{
9-
/**
10-
* The database schema.
11-
*
12-
* @var \Illuminate\Database\Schema\Builder
13-
*/
14-
protected $schema;
15-
16-
/**
17-
* Create a new migration instance.
18-
*
19-
* @return void
20-
*/
21-
public function __construct()
22-
{
23-
$this->schema = Schema::connection($this->getConnection());
24-
}
25-
269
/**
2710
* Run the migrations.
2811
*
2912
* @return void
3013
*/
3114
public function up()
3215
{
33-
$this->schema->create('oauth_personal_access_clients', function (Blueprint $table) {
16+
Schema::create('oauth_personal_access_clients', function (Blueprint $table) {
3417
$table->bigIncrements('id');
3518
$table->unsignedBigInteger('client_id');
3619
$table->timestamps();
@@ -44,16 +27,6 @@ public function up()
4427
*/
4528
public function down()
4629
{
47-
$this->schema->dropIfExists('oauth_personal_access_clients');
48-
}
49-
50-
/**
51-
* Get the migration connection name.
52-
*
53-
* @return string|null
54-
*/
55-
public function getConnection()
56-
{
57-
return config('passport.storage.database.connection');
30+
Schema::dropIfExists('oauth_personal_access_clients');
5831
}
5932
}

src/AuthCode.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,4 @@ public function client()
6868
{
6969
return $this->belongsTo(Passport::clientModel());
7070
}
71-
72-
/**
73-
* Get the current connection name for the model.
74-
*
75-
* @return string|null
76-
*/
77-
public function getConnectionName()
78-
{
79-
return config('passport.storage.database.connection') ?? $this->connection;
80-
}
8171
}

src/Client.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,6 @@ public function getIncrementing()
184184
return Passport::clientUuids() ? false : $this->incrementing;
185185
}
186186

187-
/**
188-
* Get the current connection name for the model.
189-
*
190-
* @return string|null
191-
*/
192-
public function getConnectionName()
193-
{
194-
return config('passport.storage.database.connection') ?? $this->connection;
195-
}
196-
197187
/**
198188
* Create a new factory instance for the model.
199189
*

src/PersonalAccessClient.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,4 @@ public function client()
2929
{
3030
return $this->belongsTo(Passport::clientModel());
3131
}
32-
33-
/**
34-
* Get the current connection name for the model.
35-
*
36-
* @return string|null
37-
*/
38-
public function getConnectionName()
39-
{
40-
return config('passport.storage.database.connection') ?? $this->connection;
41-
}
4232
}

src/RefreshToken.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,4 @@ public function transient()
8888
{
8989
return false;
9090
}
91-
92-
/**
93-
* Get the current connection name for the model.
94-
*
95-
* @return string|null
96-
*/
97-
public function getConnectionName()
98-
{
99-
return config('passport.storage.database.connection') ?? $this->connection;
100-
}
10191
}

0 commit comments

Comments
 (0)