Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit 12512dd

Browse files
committed
Used publish mechanism for migrations for flexibility.
(This is a breaking change if the old migrations have already been run. Users will have to be informed.)
1 parent 3f15ebc commit 12512dd

File tree

4 files changed

+7
-44
lines changed

4 files changed

+7
-44
lines changed

src/TwoFactorAuthServiceProvider.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ public function boot()
2424
{
2525
$this->loadRoutesFrom(__DIR__.'/routes.php');
2626

27-
$this->loadMigrationsFrom(__DIR__.'/database/migrations');
28-
29-
$this->loadTranslationsFrom(__DIR__.'/resources/lang', 'twofactor-auth');
30-
31-
$this->loadViewsFrom(__DIR__.'/resources/views', 'twofactor-auth');
32-
3327
$this->publishes([
3428
__DIR__.'/config/twofactor-auth.php' => config_path('twofactor-auth.php'),
3529
], 'config');
3630

31+
$this->publishes([
32+
__DIR__.'/database/migrations/' => database_path('/migrations')
33+
], 'migrations');
34+
35+
$this->loadTranslationsFrom(__DIR__.'/resources/lang', 'twofactor-auth');
3736
$this->publishes([
3837
__DIR__.'/resources/lang' => resource_path('lang/vendor/twofactor-auth'),
3938
], 'lang');
4039

40+
$this->loadViewsFrom(__DIR__.'/resources/views', 'twofactor-auth');
4141
$this->publishes([
4242
__DIR__.'/resources/views' => resource_path('views/vendor/twofactor-auth'),
4343
], 'views');

src/config/twofactor-auth.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,4 @@
6464
'post' => '/auth/token',
6565
],
6666

67-
/*
68-
|--------------------------------------------------------------------------
69-
| Database Settings
70-
|--------------------------------------------------------------------------
71-
|
72-
| Starting from Laravel 5.8, the default is to use "bigIncrements" instead
73-
| of "increments" for the "id" column on the "users" table. This setting
74-
| allows you to control what type to use for the "user_id" column on the
75-
| "two_factor_auths" table. The default is to use "unsignedBigInteger" in
76-
| order to stay in line with the changes in Laravel 5.8.
77-
|
78-
| NOTE: Modifying this setting only has an effect before you run any
79-
| migrations for this package. If you need to change the signature of
80-
| "user_id" afterwards, you will have to write your own migration for this
81-
| (see install instructions for more details).
82-
|
83-
*/
84-
85-
'big_int' => true,
86-
8767
];
Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ public function up()
1616
{
1717
Schema::create('two_factor_auths', function (Blueprint $table) {
1818
$table->string('id')->nullable();
19-
20-
if ($this->useBigInt()) {
21-
$table->unsignedBigInteger('user_id');
22-
} else {
23-
$table->unsignedInteger('user_id');
24-
}
25-
19+
$table->unsignedBigInteger('user_id');
2620
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
2721
$table->timestamps();
2822
});
@@ -37,15 +31,4 @@ public function down()
3731
{
3832
Schema::dropIfExists('two_factor_auths');
3933
}
40-
41-
/**
42-
* Determine if the type of the "user_id" column should be of type
43-
* "unsignedBigInteger".
44-
*
45-
* @return bool
46-
*/
47-
private function useBigInt()
48-
{
49-
return config('twofactor-auth.big_int');
50-
}
5134
}

0 commit comments

Comments
 (0)