File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use Illuminate \Database \Migrations \Migration ;
4
+ use Illuminate \Database \Schema \Blueprint ;
5
+ use Illuminate \Support \Facades \Schema ;
6
+ use Laravel \Fortify \Fortify ;
7
+
8
+ return new class extends Migration
9
+ {
10
+ /**
11
+ * Run the migrations.
12
+ */
13
+ public function up (): void
14
+ {
15
+ Schema::table ('users ' , function (Blueprint $ table ) {
16
+ $ table ->text ('two_factor_secret ' )
17
+ ->after ('password ' )
18
+ ->nullable ();
19
+
20
+ $ table ->text ('two_factor_recovery_codes ' )
21
+ ->after ('two_factor_secret ' )
22
+ ->nullable ();
23
+
24
+ if (Fortify::confirmsTwoFactorAuthentication ()) {
25
+ $ table ->timestamp ('two_factor_confirmed_at ' )
26
+ ->after ('two_factor_recovery_codes ' )
27
+ ->nullable ();
28
+ }
29
+ });
30
+ }
31
+
32
+ /**
33
+ * Reverse the migrations.
34
+ */
35
+ public function down (): void
36
+ {
37
+ Schema::table ('users ' , function (Blueprint $ table ) {
38
+ $ table ->dropColumn (array_merge ([
39
+ 'two_factor_secret ' ,
40
+ 'two_factor_recovery_codes ' ,
41
+ ], Fortify::confirmsTwoFactorAuthentication () ? [
42
+ 'two_factor_confirmed_at ' ,
43
+ ] : []));
44
+ });
45
+ }
46
+ };
You can’t perform that action at this time.
0 commit comments