This repository was archived by the owner on Apr 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 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+
6787];
Original file line number Diff line number Diff line change 11<?php
22
3+ use Illuminate \Support \Facades \DB ;
34use Illuminate \Support \Facades \Schema ;
45use Illuminate \Database \Schema \Blueprint ;
56use Illuminate \Database \Migrations \Migration ;
@@ -15,7 +16,13 @@ public function up()
1516 {
1617 Schema::create ('two_factor_auths ' , function (Blueprint $ table ) {
1718 $ table ->string ('id ' )->nullable ();
18- $ table ->unsignedInteger ('user_id ' );
19+
20+ if ($ this ->useBigInt ()) {
21+ $ table ->unsignedBigInteger ('user_id ' );
22+ } else {
23+ $ table ->unsignedInteger ('user_id ' );
24+ }
25+
1926 $ table ->foreign ('user_id ' )->references ('id ' )->on ('users ' )->onDelete ('cascade ' );
2027 $ table ->timestamps ();
2128 });
@@ -30,4 +37,15 @@ public function down()
3037 {
3138 Schema::dropIfExists ('two_factor_auths ' );
3239 }
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+ }
3351}
You can’t perform that action at this time.
0 commit comments